Skip to content

Commit 47f363f

Browse files
committed
Fixed the 12 ESLint errors in src/sections/Company/Brand/index.js.
Cause: commit 89c867c commented out brand sections with //, which is invalid inside JSX children — it produced react/jsx-no-comment-textnodes errors plus react/jsx-no-undef for the now-unimported brands, and left stray </div> closers. Changes in src/sections/Company/Brand/index.js: - Lines ~233-242: replaced the three broken // <div...> blocks with one proper JSX comment {/* <div id="meshery"...> ... <div id="meshery-operator"...> ... */}, preserving the intent to hide Meshery / MeshSync / Meshery Operator kits. - scrollTo:52: added if (!element) return; guard so clicking those nav links while their sections are commented out no-ops instead of throwing on null.offsetTop. Signed-off-by: Tanav Poswal <tanavposwal939@gmail.com>
1 parent 8942644 commit 47f363f

1 file changed

Lines changed: 46 additions & 28 deletions

File tree

‎src/sections/Company/Brand/index.js‎

Lines changed: 46 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,24 @@ const SMPBrand = loadable(() => import("./Brand-components/smp"));
1313
const CommunityBrand = loadable(() => import("./Brand-components/community"));
1414
const Button = loadable(() => import("../../../reusecore/Button"));
1515
const NightHawk = loadable(() => import("./Brand-components/nighthawk"));
16-
const ServiceMeshPatterns = loadable(() => import("./Brand-components/servicemeshpatterns"));
16+
const ServiceMeshPatterns = loadable(
17+
() => import("./Brand-components/servicemeshpatterns"),
18+
);
1719
const MeshMasterBrand = loadable(() => import("./Brand-components/meshmaster"));
1820
const MeshMarkBrand = loadable(() => import("./Brand-components/meshmark"));
1921
const KanvasBrand = loadable(() => import("./Brand-components/kanvas"));
2022
const BrandGuide = loadable(() => import("./Brand-components/brand-guide"));
2123
const StickFigures = loadable(() => import("./Brand-components/stickfigures"));
2224
const Catalog = loadable(() => import("./Brand-components/catalog"));
2325
const Academy = loadable(() => import("./Brand-components/academy"));
24-
const SocialBackgrounds = loadable(() => import("./Brand-components/social-backgrounds"));
26+
const SocialBackgrounds = loadable(
27+
() => import("./Brand-components/social-backgrounds"),
28+
);
2529

2630
const getDimensions = (ele) => {
2731
let dummyheight = 0,
28-
dummyoffsetTop = 0,
29-
dummyoffsetBottom = 0;
32+
dummyoffsetTop = 0,
33+
dummyoffsetBottom = 0;
3034
if (ele) {
3135
const { height } = ele.getBoundingClientRect();
3236
const offsetTop = ele.offsetTop;
@@ -49,6 +53,9 @@ const getDimensions = (ele) => {
4953
// Functions to make scroll with speed control
5054
// Element to move, element or px from, element or px to, time in ms to animate
5155
const scrollTo = (element, sectionId, duration = 2000) => {
56+
// Sections for disabled brand kits are commented out, so their refs
57+
// stay null. Bail out instead of throwing on element.offsetTop.
58+
if (!element) return;
5259
// Update URL hash
5360
if (sectionId) {
5461
window.history.pushState(null, null, `#${sectionId}`);
@@ -142,22 +149,22 @@ const Brand = () => {
142149
];
143150

144151
const sectionIdMap = {
145-
"layer5": layer5Ref,
152+
layer5: layer5Ref,
146153
"social-backgrounds": SocialBackgroundsRef,
147-
"meshery": mesheryRef,
148-
"meshsync": meshsyncRef,
154+
meshery: mesheryRef,
155+
meshsync: meshsyncRef,
149156
"meshery-operator": mesheryOperatorRef,
150157
"image-hub": imageHubRef,
151-
"smp": smpRef,
152-
"meshmark": meshmarkRef,
158+
smp: smpRef,
159+
meshmark: meshmarkRef,
153160
"service-mesh-patterns": servicemeshpatternsRef,
154-
"nighthawk": nightHawkRef,
155-
"meshmate": meshmateRef,
156-
"meshmaster": meshMasterRef,
157-
"kanvas": kanvasRef,
158-
"catalog": CatalogRef,
159-
"academy": AcademyRef,
160-
"five": stickfiguresRef
161+
nighthawk: nightHawkRef,
162+
meshmate: meshmateRef,
163+
meshmaster: meshMasterRef,
164+
kanvas: kanvasRef,
165+
catalog: CatalogRef,
166+
academy: AcademyRef,
167+
five: stickfiguresRef,
161168
};
162169

163170
// Handle initial hash navigation on page load
@@ -224,18 +231,22 @@ const Brand = () => {
224231
<div className="section" id="layer5" ref={layer5Ref}>
225232
<Layer5Brand />
226233
</div>
227-
<div className="section" id="social-backgrounds" ref={SocialBackgroundsRef}>
234+
<div
235+
className="section"
236+
id="social-backgrounds"
237+
ref={SocialBackgroundsRef}
238+
>
228239
<SocialBackgrounds />
229240
</div>
230-
// <div className="section" id="meshery" ref={mesheryRef}>
231-
// <MesheryBrand />
232-
// </div>
233-
// <div className="section" id="meshsync" ref={meshsyncRef}>
234-
// <MeshSyncBrand />
235-
// </div>
236-
// <div className="section" id="meshery-operator" ref={mesheryOperatorRef}>
237-
// <MesheryOperatorBrand />
238-
// </div>
241+
{/* <div className="section" id="meshery" ref={mesheryRef}>
242+
<MesheryBrand />
243+
</div>
244+
<div className="section" id="meshsync" ref={meshsyncRef}>
245+
<MeshSyncBrand />
246+
</div>
247+
<div className="section" id="meshery-operator" ref={mesheryOperatorRef}>
248+
<MesheryOperatorBrand />
249+
</div> */}
239250
<div className="section" id="image-hub" ref={imageHubRef}>
240251
<ImageHubBrand />
241252
</div>
@@ -245,7 +256,11 @@ const Brand = () => {
245256
<div className="section" id="meshmark" ref={meshmarkRef}>
246257
<MeshMarkBrand />
247258
</div>
248-
<div className="section" id="service-mesh-patterns" ref={servicemeshpatternsRef}>
259+
<div
260+
className="section"
261+
id="service-mesh-patterns"
262+
ref={servicemeshpatternsRef}
263+
>
249264
<ServiceMeshPatterns />
250265
</div>
251266
<div className="section" id="nighthawk" ref={nightHawkRef}>
@@ -357,7 +372,10 @@ const Brand = () => {
357372
visibleSection === "ServiceMeshPatterns" ? "selected" : ""
358373
}`}
359374
onClick={() => {
360-
scrollTo(servicemeshpatternsRef.current, "service-mesh-patterns");
375+
scrollTo(
376+
servicemeshpatternsRef.current,
377+
"service-mesh-patterns",
378+
);
361379
}}
362380
>
363381
<span>Cloud Native Patterns</span>

0 commit comments

Comments
 (0)