Socket
Socket
Sign inDemoInstall

@sanity/ui-workshop

Package Overview
Dependencies
416
Maintainers
51
Versions
120
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @sanity/ui-workshop

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


Version published
Weekly downloads
3.6K
decreased by-28.34%
Maintainers
51
Install size
46.5 MB
Created
Weekly downloads
 

Changelog

Source

2.0.13 (2024-05-03)

Bug Fixes

  • build: update dependencies and build config (c84657e)
  • navbar: remove min-width on buttons (3c722bb)
  • plugin-perf: update profiler api (315e1a1)

Readme

Source

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

Keywords

FAQs

Last updated on 03 May 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc