2.0.13 • Published 6 days ago

@sanity/ui-workshop v2.0.13

Weekly downloads
-
License
MIT
Repository
github
Last release
6 days ago

Sanity UI Workshop

An environment for designing, reviewing, and quality-testing React components.

# Install `@sanity/ui-workshop` as dev dependency
npm install @sanity/ui-workshop -D

# Install peer dependencies
npm install @sanity/icons @sanity/ui react react-dom styled-components

npm version

Basic usage

Add a workshop.config.ts (or .js) in the root of your project:

import {defineConfig} from '@sanity/ui-workshop'

export default defineConfig({
  title: 'My UI Workshop',
})

Start the workshop

workshop dev

workshop will automatically find workshop "scopes" by searching for files mathing these patterns:

  • src/**/__workshop__/index.js
  • src/**/__workshop__/index.jsx
  • src/**/__workshop__/index.ts
  • src/**/__workshop__/index.tsx

Define your first workshop scope by creating src/__workshop__/index.tsx:

import {
  defineScope,
  useBoolean,
  useNumber,
  useSelect,
  useString,
  useText,
} from '@sanity/ui-workshop'

export default defineScope({
  name: 'test',
  title: 'Test',
  stories: [
    {
      name: 'test',
      title: 'Test',
      component: TestStory,
    },
  ],
})

const options = {
  None: '',
  Small: 'sm',
  Medium: 'md',
  Large: 'lg',
}

function TestStory() {
  const text = useText('Text', 'Hello, world')
  const boolean = useBoolean('Boolean', true)
  const number = useNumber('Number', 1234)
  const string = useString('String', '...')
  const option = useSelect('Select option', options)

  return (
    <div>
      <h1>This is my first story.</h1>
      <p>Some text: {text}</p>
      <p>A boolean: {boolean ? 'true' : 'false'}</p>
      <p>A number: {number}</p>
      <p>A string: {string}</p>
      <p>An option: {option}</p>
    </div>
  )
}

License

MIT

2.0.13

6 days ago

2.0.12

29 days ago

2.0.11

1 month ago

2.0.9

1 month ago

2.0.8

1 month ago

2.0.10

1 month ago

2.0.7

2 months ago

2.0.5

3 months ago

2.0.4

3 months ago

2.0.6

3 months ago

1.2.7

10 months ago

1.2.6

10 months ago

1.2.5

10 months ago

2.0.3

5 months ago

2.0.2

5 months ago

2.0.1

5 months ago

2.0.0

6 months ago

1.2.10

9 months ago

1.2.11

9 months ago

1.2.9

10 months ago

1.2.4

11 months ago

1.2.3

11 months ago

1.2.2

11 months ago

1.2.1

1 year ago

1.2.0

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.1.8

1 year ago

1.1.7

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

0.6.2-next.36

2 years ago

0.6.2-next.30

2 years ago

1.0.0-beta.11

1 year ago

1.0.0-beta.12

1 year ago

1.0.0-beta.10

1 year ago

1.0.0-next.3

2 years ago

1.0.0-beta.13

1 year ago

1.0.0-beta.2

2 years ago

1.0.0-beta.3

2 years ago

1.0.0-beta.4

2 years ago

1.0.0-beta.5

2 years ago

1.0.0-beta.0

2 years ago

1.0.0-beta.1

2 years ago

1.0.0-beta.6

1 year ago

1.0.0-beta.7

1 year ago

1.0.0-beta.8

1 year ago

1.0.0-beta.9

1 year ago

0.6.1-next.4

2 years ago

0.6.1-next.14

2 years ago

0.6.1-next.16

2 years ago

0.5.2-next.4

2 years ago

0.5.0

2 years ago

0.5.1

2 years ago

0.6.1-next.22

2 years ago

0.6.2-next.10

2 years ago

0.4.17

2 years ago

0.4.16

2 years ago

0.6.2-next.5

2 years ago

0.6.2-next.18

2 years ago

0.6.1

2 years ago

0.6.0

2 years ago

0.4.9

2 years ago

0.4.8

2 years ago

0.4.9-next.6

2 years ago

0.4.9-next.5

2 years ago

0.4.15-next.8

2 years ago

0.4.10

2 years ago

0.4.15

2 years ago

0.4.13

2 years ago

0.4.14

2 years ago

0.4.11

2 years ago

0.4.12

2 years ago

0.4.5

2 years ago

0.4.7

2 years ago

0.4.6

2 years ago

0.4.4

2 years ago

0.4.3

2 years ago

0.4.2

2 years ago

0.3.16-next.19

2 years ago

0.4.1

2 years ago

0.4.0

2 years ago

0.3.15

2 years ago

0.3.16-next.18

2 years ago

0.3.14

2 years ago

0.3.13

2 years ago

0.3.12

2 years ago

0.3.11

2 years ago

0.3.10

2 years ago

0.3.9

2 years ago

0.3.8-next.1

2 years ago

0.3.8

2 years ago

0.3.7

3 years ago

0.3.6

3 years ago

0.3.5-next.12

3 years ago

0.3.5-next.13

3 years ago

0.3.5

3 years ago

0.3.4

3 years ago

0.3.3

3 years ago

0.3.2

3 years ago

0.3.0

3 years ago

0.3.1

3 years ago

0.2.6

3 years ago

0.2.5

3 years ago

0.2.4

3 years ago

0.2.3

3 years ago

0.2.2-next.19

3 years ago

0.2.2

3 years ago

0.2.2-next.21

3 years ago

0.2.2-next.2

3 years ago

0.2.2-next.1

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.25

3 years ago

0.1.24

3 years ago