Skip to content

Commit

Permalink
dev(core): add WorkspacePreview workshop story
Browse files Browse the repository at this point in the history
  • Loading branch information
hermanwikner committed Nov 7, 2022
1 parent 48968b6 commit 0f36a5c
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import React, {CSSProperties} from 'react'
import {IceCreamIcon} from '@sanity/icons'
import {Card, Flex} from '@sanity/ui'
import {useBoolean, useSelect, useString} from '@sanity/ui-workshop'
import {WorkspacePreview} from '../workspace'

const CARD_INLINE_STYLE: CSSProperties = {
width: 250,
}

const STATE_OPTIONS: Record<string, 'logged-in' | 'logged-out' | 'no-access'> = {
'logged-in': 'logged-in',
'logged-out': 'logged-out',
'no-access': 'no-access',
}

export default function WorkspacePreviewStory() {
const title = useString('Title', 'Title') || ''
const subtitle = useString('Subtitle', 'Subtitle') || ''
const state = useSelect('State', STATE_OPTIONS, 'logged-in') || 'logged-in'
const selected = useBoolean('Selected', false) || false

return (
<Flex align="center" height="fill" justify="center">
<Card style={CARD_INLINE_STYLE}>
<WorkspacePreview
icon={IceCreamIcon}
selected={selected}
state={state}
subtitle={subtitle}
title={title}
/>
</Card>
</Flex>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,9 @@ export default defineScope('sanity/studio/navbar', 'Navbar', [
title: 'SearchDialog',
component: lazy(() => import('./SearchDialogStory')),
},
{
name: 'workspacePreview',
title: 'WorkspacePreview',
component: lazy(() => import('./WorkspacePreviewStory')),
},
])

0 comments on commit 0f36a5c

Please sign in to comment.