-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
Adds a storybook addon that enables chakra-ui along with its colormode feature.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
# Dependency directory | ||
node_modules | ||
|
||
# Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
*.lcov | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
jspm_packages/ | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# TypeScript cache | ||
*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
.env.test | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
|
||
# next.js build output | ||
.next | ||
|
||
# nuxt.js build output | ||
.nuxt | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# Serverless directories | ||
.serverless/ | ||
|
||
# FuseBox cache | ||
.fusebox/ | ||
|
||
# DynamoDB Local files | ||
.dynamodb/ | ||
|
||
# OS metadata | ||
.DS_Store | ||
Thumbs.db | ||
|
||
# Ignore built ts files | ||
__tests__/runner/* | ||
lib | ||
dist |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# @chakra-ui/storybook-addon | ||
|
||
Use Chakra UI in your Storybook stories. | ||
|
||
Wraps each of your stories with [`ChakraProvider`][chakraprovider] which can be | ||
configured using Storybook parameters. | ||
|
||
## Installation | ||
|
||
### yarn | ||
|
||
```sh | ||
yarn add -D @snek-at/storybook-addon-chakra-ui | ||
``` | ||
|
||
### npm | ||
|
||
```sh | ||
npm i -D @snek-at/storybook-addon-chakra-ui | ||
``` | ||
|
||
Add the addon to your configuration in `.storybook/main.js`: | ||
|
||
```js | ||
module.exports = { | ||
addons: ['@snek-at/storybook-addon-chakra-ui'] | ||
} | ||
``` | ||
|
||
## Configuring `ChakraProvider` | ||
|
||
If you need to customize the props passed to `ChakraProvider` for your stories | ||
(to use a custom `theme`, for example), you'll need to create custom Storybook | ||
parameters. | ||
|
||
To set global parameters for this addon, add a `chakra` object to the | ||
`parameters` export in `.storybook/preview.js`: | ||
|
||
```js | ||
import myTheme from '../theme' | ||
export const parameters = {chakra: {theme: myTheme}} | ||
``` | ||
|
||
The `chakra` parameters take the same shape as the `props` for `ChakraProvider`. | ||
[See the `ChakraProvider` props table][chakraprovider] to see the list of | ||
possible parameters. | ||
|
||
### Overriding `ChakraProvider` configuration for individual components or stories | ||
|
||
Storybook allows you to define parameters at multiple levels: global, component, | ||
and story. We recommend setting default parameters at the global level, and | ||
overriding them at the component or story when necessary. See the | ||
[Storybook Parameters documentation](https://storybook.js.org/docs/react/writing-stories/parameters) | ||
for more information. | ||
|
||
[chakraprovider]: https://chakra-ui.com/docs/getting-started#chakraprovider-props |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export declare const ADDON_ID = "@snek-at/chakra-ui-storybook-addon"; | ||
export declare const PARAM_KEY = "chakra-ui"; | ||
export declare const CHANGE: string; | ||
export declare const DECORATOR: string; | ||
export declare const THEME: string; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './withChakra'; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/// <reference types="react" /> | ||
declare const CMSelector: () => JSX.Element; | ||
export default CMSelector; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as CMSelector } from './CMSelector'; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { withChakra } from './withChakra'; | ||
export declare const decorators: (typeof withChakra)[]; | ||
export declare const globalTypes: { | ||
isDarkmode: boolean; | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export {}; |