-
Notifications
You must be signed in to change notification settings - Fork 388
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dev(core): add
WorkspacePreview
workshop story
- Loading branch information
1 parent
48968b6
commit 0f36a5c
Showing
2 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
packages/sanity/src/core/studio/components/navbar/__workshop__/WorkspacePreviewStory.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters