Skip to content
This repository was archived by the owner on Mar 25, 2025. It is now read-only.

Commit 8a365c3

Browse files
tripleWdotcomTigge
authored andcommitted
fix(docs): Card example code corrected (#98)
1 parent 18c39f7 commit 8a365c3

File tree

1 file changed

+15
-14
lines changed
  • packages/docs/src/mdx/coreComponents

1 file changed

+15
-14
lines changed

packages/docs/src/mdx/coreComponents/Card.mdx

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ export const RadioSelectableListItem = () => {
175175
}
176176

177177
export const DemoComponent = ({}) => {
178+
const [value, setValue] = useState(false)
179+
const [valueText, setValueText] = useState('')
178180
const [isExpanded, setExpanded] = useState(true)
179181
const onClick = useCallback(() => {}, [])
180182
const onSelect = () => {}
@@ -318,7 +320,7 @@ export const DemoComponent = ({}) => {
318320
<Button onClick={onClick} label="Action 1" />
319321
<Button onClick={onClick} label="Action 2" variant="secondary" />
320322
<CardFooterSpacer />
321-
<Switch value={false} onChange={() => {}} />
323+
<Switch checked={value} onValueChange={setValue} />
322324
<Typography>Input label</Typography>
323325
</CardFooter>
324326
</Card>
@@ -356,38 +358,38 @@ export const DemoComponent = ({}) => {
356358
<CardPlainContent>
357359
<ContentListItem listHeight="large">
358360
<Typography>Input label</Typography>
359-
<Switch value={false} onChange={() => {}} />
361+
<Switch checked={value} onValueChange={setValue} />
360362
</ContentListItem>
361363
<ContentDivider />
362364
<ContentListItem listHeight="large">
363365
<Typography>Input label</Typography>
364-
<Switch value={true} onChange={() => {}} />
366+
<Switch checked={value} onValueChange={setValue} />
365367
</ContentListItem>
366368
<ContentDivider />
367369
<FormSection>
368370
<TextInputField
369371
label="Input label"
370-
value=""
371-
onValueChange={() => {}}
372+
value={valueText}
373+
onValueChange={setValueText}
372374
placeholder="Placeholder"
373375
/>
374376
<TextInputField
375377
label="Input label"
376-
value=""
377-
onValueChange={() => {}}
378+
value={valueText}
379+
onValueChange={setValueText}
378380
placeholder="Placeholder"
379381
/>
380382
</FormSection>
381383
<SpaceBlock variant={32} />
382384
<FormSection title="Group label" />
383385
<ContentListItem listHeight="large">
384386
<Typography>Input label</Typography>
385-
<Switch value={false} onChange={() => {}} />
387+
<Switch checked={value} onValueChange={setValue} />
386388
</ContentListItem>
387389
<ContentDivider />
388390
<ContentListItem listHeight="large">
389391
<Typography>Input label</Typography>
390-
<Switch value={true} onChange={() => {}} />
392+
<Switch checked={value} onValueChange={setValue} />
391393
</ContentListItem>
392394
<ContentDivider />
393395
<RadioSelectableListItem />
@@ -423,7 +425,7 @@ export const onClick = () => {}
423425
### Card with header, content and footer
424426

425427
```typescript type=live
426-
<Card>
428+
<Card width="small">
427429
<CardHeader>
428430
<CardHeaderTypography>CardHeader</CardHeaderTypography>
429431
</CardHeader>
@@ -443,12 +445,12 @@ export const onClick = () => {}
443445
<CardPlainContent>
444446
<ContentListItem listHeight="large">
445447
<Typography>Input label</Typography>
446-
<Switch value={false} onChange={() => {}} />
448+
<Switch checked={false} onChange={() => {}} />
447449
</ContentListItem>
448450
<ContentDivider />
449451
<ContentListItem listHeight="large">
450452
<Typography>Input label</Typography>
451-
<Switch value={true} onChange={() => {}} />
453+
<Switch checked={true} onChange={() => {}} />
452454
</ContentListItem>
453455
<ContentDivider />
454456
<FormSection>
@@ -469,7 +471,7 @@ export const onClick = () => {}
469471
<FormSection title="Group label" />
470472
<ContentListItem listHeight="large">
471473
<Typography>Input label</Typography>
472-
<Switch value={false} onChange={() => {}} />
474+
<Switch checked={false} onChange={() => {}} />
473475
</ContentListItem>
474476
<ContentDivider />
475477
<ContentListItem listHeight="large">
@@ -494,7 +496,6 @@ export const onClick = () => {}
494496
caption="Selected applications will automatically be installed and reinstalled if removed."
495497
/>
496498
<RadioButtonGroup
497-
label="Select your favorite fruit"
498499
name="radioValue"
499500
options={[
500501
{ value: 'apple', label: 'Apple' },

0 commit comments

Comments
 (0)