Skip to content

Commit

Permalink
test(breadcrumbs): update workshop stories
Browse files Browse the repository at this point in the history
  • Loading branch information
mariuslundgard committed Nov 28, 2024
1 parent ff48687 commit ce49f48
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 2 deletions.
58 changes: 58 additions & 0 deletions src/core/components/breadcrumbs/__workshop__/buttons.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import {ChevronRightIcon} from '@sanity/icons'
import {Box, Breadcrumbs, Button, Card, Flex, Text} from '@sanity/ui'
import {useSelect} from '@sanity/ui-workshop'

const BREADCRUMBS_MAX_LENGTH_OPTIONS = {
'(none)': 0,
'1': 1,
'2': 2,
'3': 3,
'4': 4,
'5': 5,
'6': 6,
'7': 7,
}

export default function Example() {
const maxLength =
useSelect('Max. length', BREADCRUMBS_MAX_LENGTH_OPTIONS, 0, 'Props') || undefined

return (
<Flex align="center" height="fill" justify="center" padding={4} sizing="border">
<Card padding={1} radius={3} shadow={1}>
<Breadcrumbs
gapX={0}
expandButton={{padding: 2}}
maxLength={maxLength}
separator={
<Box paddingY={2} style={{opacity: 0.5}}>
<Text muted size={1}>
<ChevronRightIcon />
</Text>
</Box>
}
// space={0}
>
<Button href="#" mode="bleed" padding={2} text="Root" />
<Button href="#" mode="bleed" padding={2} text="Category A of some length" />
<Button href="#" mode="bleed" padding={2} text="Category B" />
<Button href="#" mode="bleed" padding={2} text="Category C" />
<Button
href="#"
mode="bleed"
padding={2}
text="Category D of an every larger and more extended length"
textOverflow="none"
/>
<Button href="#" mode="bleed" padding={2} text="Category E" />
<Button href="#" mode="bleed" padding={2} text="Category F" />
<Box padding={2}>
<Text size={1} weight="semibold">
Item
</Text>
</Box>
</Breadcrumbs>
</Card>
</Flex>
)
}
6 changes: 4 additions & 2 deletions src/core/components/breadcrumbs/__workshop__/example.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,17 @@ export default function Example() {
useSelect('Max. length', BREADCRUMBS_MAX_LENGTH_OPTIONS, 0, 'Props') || undefined

return (
<Flex align="center" height="fill" justify="center">
<Flex align="center" height="fill" justify="center" padding={4} sizing="border">
<Breadcrumbs
gapX={1}
gapY={3}
maxLength={maxLength}
separator={
<Text muted size={1}>
/
</Text>
}
space={2}
// space={2}
>
<Text size={1}>
<a href="#">Root</a>
Expand Down
5 changes: 5 additions & 0 deletions src/core/components/breadcrumbs/__workshop__/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,10 @@ export default defineScope({
title: 'Example',
component: lazy(() => import('./example')),
},
{
name: 'buttons',
title: 'Buttons',
component: lazy(() => import('./buttons')),
},
],
})

0 comments on commit ce49f48

Please sign in to comment.