Skip to content

Commit d566dc1

Browse files
test(breadcrumbs): update workshop stories
1 parent 77c562d commit d566dc1

File tree

3 files changed

+67
-2
lines changed

3 files changed

+67
-2
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import {ChevronRightIcon} from '@sanity/icons'
2+
import {Box, Breadcrumbs, Button, Card, Flex, Text} from '@sanity/ui'
3+
import {useSelect} from '@sanity/ui-workshop'
4+
5+
const BREADCRUMBS_MAX_LENGTH_OPTIONS = {
6+
'(none)': 0,
7+
'1': 1,
8+
'2': 2,
9+
'3': 3,
10+
'4': 4,
11+
'5': 5,
12+
'6': 6,
13+
'7': 7,
14+
}
15+
16+
export default function Example() {
17+
const maxLength =
18+
useSelect('Max. length', BREADCRUMBS_MAX_LENGTH_OPTIONS, 0, 'Props') || undefined
19+
20+
return (
21+
<Flex align="center" height="fill" justify="center" padding={4} sizing="border">
22+
<Card padding={1} radius={3} shadow={1}>
23+
<Breadcrumbs
24+
gapX={0}
25+
expandButton={{padding: 2}}
26+
maxLength={maxLength}
27+
separator={
28+
<Box paddingY={2} style={{opacity: 0.5}}>
29+
<Text muted size={1}>
30+
<ChevronRightIcon />
31+
</Text>
32+
</Box>
33+
}
34+
// space={0}
35+
>
36+
<Button href="#" mode="bleed" padding={2} text="Root" />
37+
<Button href="#" mode="bleed" padding={2} text="Category A of some length" />
38+
<Button href="#" mode="bleed" padding={2} text="Category B" />
39+
<Button href="#" mode="bleed" padding={2} text="Category C" />
40+
<Button
41+
href="#"
42+
mode="bleed"
43+
padding={2}
44+
text="Category D of an every larger and more extended length"
45+
textOverflow="none"
46+
/>
47+
<Button href="#" mode="bleed" padding={2} text="Category E" />
48+
<Button href="#" mode="bleed" padding={2} text="Category F" />
49+
<Box padding={2}>
50+
<Text size={1} weight="semibold">
51+
Item
52+
</Text>
53+
</Box>
54+
</Breadcrumbs>
55+
</Card>
56+
</Flex>
57+
)
58+
}

src/core/components/breadcrumbs/__workshop__/example.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,17 @@ export default function Example() {
1717
useSelect('Max. length', BREADCRUMBS_MAX_LENGTH_OPTIONS, 0, 'Props') || undefined
1818

1919
return (
20-
<Flex align="center" height="fill" justify="center">
20+
<Flex align="center" height="fill" justify="center" padding={4} sizing="border">
2121
<Breadcrumbs
22+
gapX={1}
23+
gapY={3}
2224
maxLength={maxLength}
2325
separator={
2426
<Text muted size={1}>
2527
/
2628
</Text>
2729
}
28-
space={2}
30+
// space={2}
2931
>
3032
<Text size={1}>
3133
<a href="#">Root</a>

src/core/components/breadcrumbs/__workshop__/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,10 @@ export default defineScope({
1010
title: 'Example',
1111
component: lazy(() => import('./example')),
1212
},
13+
{
14+
name: 'buttons',
15+
title: 'Buttons',
16+
component: lazy(() => import('./buttons')),
17+
},
1318
],
1419
})

0 commit comments

Comments
 (0)