From 92a4fdb0ead494014eb22c2f39b5106017bb4a83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20Lundga=CC=8Ard?= Date: Thu, 28 Nov 2024 13:41:30 +0100 Subject: [PATCH] test: update workshop stories --- src/core/__workshop__/constants.ts | 4 +- .../breadcrumbs/__workshop__/buttons.tsx | 58 +++++++++++++++++++ .../breadcrumbs/__workshop__/example.tsx | 6 +- .../breadcrumbs/__workshop__/index.ts | 5 ++ .../primitives/button/__workshop__/custom.tsx | 7 ++- .../button/__workshop__/mixedChildren.tsx | 2 +- .../primitives/button/__workshop__/props.tsx | 12 +++- .../__workshop__/sanityUploadButton.tsx | 2 +- .../button/__workshop__/stacked.tsx | 6 +- .../primitives/label/__workshop__/plain.tsx | 2 +- 10 files changed, 89 insertions(+), 15 deletions(-) create mode 100644 src/core/components/breadcrumbs/__workshop__/buttons.tsx diff --git a/src/core/__workshop__/constants.ts b/src/core/__workshop__/constants.ts index 1fd4c983b..42666ecda 100644 --- a/src/core/__workshop__/constants.ts +++ b/src/core/__workshop__/constants.ts @@ -246,8 +246,8 @@ export const WORKSHOP_TEXT_INPUT_TYPE_OPTIONS: {[key: string]: TextInputType} = 'color': 'color', } -export const WORKSHOP_TEXT_OVERFLOW_OPTIONS: {[key: string]: 'ellipsis' | ''} = { - None: '', +export const WORKSHOP_TEXT_OVERFLOW_OPTIONS: {[key: string]: 'ellipsis' | 'none'} = { + None: 'none', Ellipsis: 'ellipsis', } diff --git a/src/core/components/breadcrumbs/__workshop__/buttons.tsx b/src/core/components/breadcrumbs/__workshop__/buttons.tsx new file mode 100644 index 000000000..2cd7cfe59 --- /dev/null +++ b/src/core/components/breadcrumbs/__workshop__/buttons.tsx @@ -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 ( + + + + + + + + } + // space={0} + > + ))} - + {tones.map(([title, tone]) => ( ) diff --git a/src/core/primitives/button/__workshop__/props.tsx b/src/core/primitives/button/__workshop__/props.tsx index ecca2863e..6e167ddf9 100644 --- a/src/core/primitives/button/__workshop__/props.tsx +++ b/src/core/primitives/button/__workshop__/props.tsx @@ -9,11 +9,12 @@ import { WORKSHOP_ICON_SYMBOL_OPTIONS, WORKSHOP_TEXT_SIZE_OPTIONS, WORKSHOP_SPACE_OPTIONS, + WORKSHOP_TEXT_OVERFLOW_OPTIONS, } from '../../../__workshop__/constants' export default function ButtonStory() { const disabled = useBoolean('Disabled', false, 'Props') - const fontSize = useSelect('Font size', WORKSHOP_TEXT_SIZE_OPTIONS, 2, 'Props') + const fontSize = useSelect('Font size', WORKSHOP_TEXT_SIZE_OPTIONS, 1, 'Props') const icon = useSelect('Icon', WORKSHOP_ICON_SYMBOL_OPTIONS, 'add-circle', 'Props') const iconRight = useSelect('Icon (right)', WORKSHOP_ICON_SYMBOL_OPTIONS, '', 'Props') const justify = useSelect('Justify', WORKSHOP_FLEX_JUSTIFY_OPTIONS, 'center', 'Props') @@ -26,9 +27,15 @@ export default function ButtonStory() { const textAlign = useSelect('Text align', WORKSHOP_BUTTON_TEXT_ALIGN_OPTIONS, undefined, 'Props') || undefined const textProp = useText('Text', 'Label', 'Props') + const textOverflow = useSelect( + 'Text overflow', + WORKSHOP_TEXT_OVERFLOW_OPTIONS, + 'ellipsis', + 'Props', + ) return ( - +