-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
1,090 additions
and
241 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -9,3 +9,4 @@ babel | |
*.js | ||
v2-incompatible.js.template | ||
*.json | ||
assets/ |
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
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,15 @@ | ||
import {Box, Stack, Text} from '@sanity/ui' | ||
import React, {ReactNode} from 'react' | ||
|
||
export function CustomField(props: {children?: ReactNode; title?: ReactNode}) { | ||
const {children, title} = props | ||
|
||
return ( | ||
<Stack space={3}> | ||
<Text size={1} weight="semibold"> | ||
{title} | ||
</Text> | ||
<Box>{children}</Box> | ||
</Stack> | ||
) | ||
} |
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,14 @@ | ||
import {defineScope} from '@sanity/ui-workshop' | ||
import {lazy} from 'react' | ||
|
||
export default defineScope({ | ||
name: 'custom', | ||
title: 'Custom (example)', | ||
stories: [ | ||
{ | ||
name: 'props', | ||
title: 'Props', | ||
component: lazy(() => import('./props')), | ||
}, | ||
], | ||
}) |
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,20 @@ | ||
import {Box, Card, Container, Text} from '@sanity/ui' | ||
import {useString} from '@sanity/ui-workshop' | ||
import {CustomField} from '../CustomField' | ||
import React from 'react' | ||
|
||
export default function PropsStory() { | ||
const title = useString('Title', 'My custom field') | ||
|
||
return ( | ||
<Container width={1}> | ||
<Box paddingX={4} paddingY={[5, 6, 7]}> | ||
<CustomField title={title}> | ||
<Card border padding={3}> | ||
<Text>This is just an example</Text> | ||
</Card> | ||
</CustomField> | ||
</Box> | ||
</Container> | ||
) | ||
} |
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,5 @@ | ||
import {defineConfig} from '@sanity/ui-workshop' | ||
|
||
export default defineConfig({ | ||
title: 'Workshop Starter', | ||
}) |
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,26 @@ | ||
# Preset: ui-workshop | ||
|
||
## Usage | ||
|
||
### Inject into existing package | ||
`npx @sanity/plugin-kit inject --preset-only --preset ui-workshop` | ||
|
||
### Use to init plugin | ||
`npx @sanity/plugin-kit init --preset ui-workshop <new-plugin-name>` | ||
|
||
## What does it do? | ||
|
||
Sets up your package with [@sanity/ui-workshop](https://github.com/sanity-io/ui-workshop), | ||
to make component testing a breeze. | ||
|
||
- Adds [@sanity/ui-workshop](https://github.com/sanity-io/ui-workshop) dev dependency. | ||
- Adds a example files for testing components using @sanity/ui-workshop | ||
- Adds .workshop to .gitignore | ||
- | ||
## Manual steps after inject | ||
|
||
* Run `npm i` to install dependencies. | ||
* Start the workshop with `workshop dev`. | ||
* Put your plugin/package components into workshop to test them. | ||
* Refer to @sanity/ui-workshop [README](https://github.com/sanity-io/ui-workshop#basic-usage) for more. | ||
|
Oops, something went wrong.