Skip to content

Commit b2e3c5a

Browse files
authored
Fix UseCasesTabs JSX structure, align container width with cards, and clean up styles and syntax issues (#916)
1 parent c665367 commit b2e3c5a

2 files changed

Lines changed: 392 additions & 113 deletions

File tree

src/components/UseCasesTabs.js

Lines changed: 114 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ const useCases = [
125125
icons: [],
126126
},
127127
];
128-
129128
export default function UseCasesTabs() {
130129
const [selected, setSelected] = useState(0);
131130
const selectedCase = useCases[selected];
@@ -147,130 +146,132 @@ export default function UseCasesTabs() {
147146
const contentDesc = isDark ? "#c9ccd1" : "#444";
148147

149148
return (
150-
<div
151-
className={styles.useCasesTabs}
152-
style={{
153-
display: "flex",
154-
background: "transparent",
155-
borderRadius: 16,
156-
padding: "32px 32px 2px 0",
157-
gap: 32,
158-
alignItems: "stretch",
159-
}}
160-
>
161-
{/* Tabs */}
162-
<div
163-
style={{
164-
minWidth: 160,
165-
display: "flex",
166-
flexDirection: "column",
167-
gap: 6,
168-
maxHeight: "calc(4 * 44px + 3 * 12px + 16px)",
169-
overflowY: "auto",
170-
paddingBottom: 16,
171-
boxSizing: "border-box",
172-
position: "relative",
173-
}}
174-
>
175-
{useCases.map((uc, idx) => {
176-
const [hovered, setHovered] = React.useState(false);
177-
const isActive = selected === idx;
178-
// Hover background
179-
const hoverBg = isDark ? "#282d36" : "#eceff1";
180-
// Hover text color
181-
const hoverText = isDark ? "#fff" : "#222";
182-
return (
183-
<button
184-
key={uc.key}
185-
onClick={() => setSelected(idx)}
186-
onMouseEnter={() => setHovered(true)}
187-
onMouseLeave={() => setHovered(false)}
188-
style={{
189-
background: isActive ? tabGradient : hovered ? hoverBg : bg,
190-
color: isActive
191-
? "#fff"
192-
: hovered
193-
? hoverText
194-
: tabInactiveText,
195-
border: isActive ? `2px solid ${bg}` : "none",
196-
borderRadius: 18,
197-
padding: "10px 22px",
198-
fontWeight: 700,
199-
fontSize: 16,
200-
minWidth: 180,
201-
cursor: "pointer",
202-
outline: "none",
203-
transition: "background 0.2s, color 0.2s, box-shadow 0.2s",
204-
boxShadow: "none",
205-
}}
206-
aria-selected={isActive}
207-
aria-controls={`usecase-panel-${uc.key}`}
208-
>
209-
{uc.label}
210-
</button>
211-
);
212-
})}
213-
</div>
214-
{/* Content */}
149+
<div className={styles.responsiveSection}>
215150
<div
151+
className={styles.useCasesTabs}
216152
style={{
217-
flex: 1,
218153
display: "flex",
219-
flexDirection: "column",
220-
justifyContent: "center",
154+
background: "transparent",
155+
borderRadius: 16,
156+
padding: "32px 32px 2px 0",
157+
gap: 32,
158+
alignItems: "stretch",
221159
}}
222160
>
223-
<div style={{ display: "flex", alignItems: "center", gap: 12 }}>
224-
<h3
225-
style={{
226-
margin: 0,
227-
fontSize: 22,
228-
fontWeight: 700,
229-
color: contentTitle,
230-
}}
231-
>
232-
{selectedCase.title}
233-
</h3>
234-
{selectedCase.version && (
235-
<span style={{ color: tabActive, fontWeight: 600, fontSize: 16 }}>
236-
{selectedCase.version}
237-
</span>
238-
)}
239-
</div>
240-
<p
161+
{/* Tabs */}
162+
<div
241163
style={{
242-
margin: "16px 0 24px 0",
243-
color: contentDesc,
244-
fontSize: 17,
245-
lineHeight: 1.6,
164+
minWidth: 160,
165+
display: "flex",
166+
flexDirection: "column",
167+
gap: 6,
168+
maxHeight: "calc(4 * 44px + 3 * 12px + 16px)",
169+
overflowY: "auto",
170+
paddingBottom: 16,
171+
boxSizing: "border-box",
172+
position: "relative",
246173
}}
247174
>
248-
{selectedCase.description}
249-
</p>
250-
<div style={{ display: "flex", alignItems: "center", gap: 18 }}>
251-
{/* Placeholder for icons if needed */}
252-
{selectedCase.icons.map((icon, idx) => (
253-
<img
254-
key={idx}
255-
src={icon}
256-
alt="icon"
257-
style={{ height: 32, width: "auto" }}
258-
/>
259-
))}
175+
{useCases.map((uc, idx) => {
176+
const [hovered, setHovered] = React.useState(false);
177+
const isActive = selected === idx;
178+
// Hover background
179+
const hoverBg = isDark ? "#282d36" : "#eceff1";
180+
// Hover text color
181+
const hoverText = isDark ? "#fff" : "#222";
182+
return (
183+
<button
184+
key={uc.key}
185+
onClick={() => setSelected(idx)}
186+
onMouseEnter={() => setHovered(true)}
187+
onMouseLeave={() => setHovered(false)}
188+
style={{
189+
background: isActive ? tabGradient : hovered ? hoverBg : bg,
190+
color: isActive
191+
? "#fff"
192+
: hovered
193+
? hoverText
194+
: tabInactiveText,
195+
border: isActive ? `2px solid ${bg}` : "none",
196+
borderRadius: 18,
197+
padding: "10px 22px",
198+
fontWeight: 700,
199+
fontSize: 16,
200+
minWidth: 180,
201+
cursor: "pointer",
202+
outline: "none",
203+
transition: "background 0.2s, color 0.2s, box-shadow 0.2s",
204+
boxShadow: "none",
205+
}}
206+
aria-selected={isActive}
207+
aria-controls={`usecase-panel-${uc.key}`}
208+
>
209+
{uc.label}
210+
</button>
211+
);
212+
})}
260213
</div>
261-
<div style={{ marginTop: 18 }}>
262-
<a
263-
href={selectedCase.learnMore}
214+
{/* Content */}
215+
<div
216+
style={{
217+
flex: 1,
218+
display: "flex",
219+
flexDirection: "column",
220+
justifyContent: "center",
221+
}}
222+
>
223+
<div style={{ display: "flex", alignItems: "center", gap: 12 }}>
224+
<h3
225+
style={{
226+
margin: 0,
227+
fontSize: 22,
228+
fontWeight: 700,
229+
color: contentTitle,
230+
}}
231+
>
232+
{selectedCase.title}
233+
</h3>
234+
{selectedCase.version && (
235+
<span style={{ color: tabActive, fontWeight: 600, fontSize: 16 }}>
236+
{selectedCase.version}
237+
</span>
238+
)}
239+
</div>
240+
<p
264241
style={{
265-
color: "#ff6133",
266-
fontWeight: 600,
267-
fontSize: 16,
268-
textDecoration: "none",
242+
margin: "16px 0 24px 0",
243+
color: contentDesc,
244+
fontSize: 17,
245+
lineHeight: 1.6,
269246
}}
270-
target="_self"
271247
>
272-
Learn More &rarr;
273-
</a>
248+
{selectedCase.description}
249+
</p>
250+
<div style={{ display: "flex", alignItems: "center", gap: 18 }}>
251+
{/* Placeholder for icons if needed */}
252+
{selectedCase.icons.map((icon, idx) => (
253+
<img
254+
key={idx}
255+
src={icon}
256+
alt="icon"
257+
style={{ height: 32, width: "auto" }}
258+
/>
259+
))}
260+
</div>
261+
<div style={{ marginTop: 18 }}>
262+
<a
263+
href={selectedCase.learnMore}
264+
style={{
265+
color: "#ff6133",
266+
fontWeight: 600,
267+
fontSize: 16,
268+
textDecoration: "none",
269+
}}
270+
target="_self"
271+
>
272+
Learn More &rarr;
273+
</a>
274+
</div>
274275
</div>
275276
</div>
276277
</div>

0 commit comments

Comments
 (0)