Skip to content

Commit

Permalink
Features/storybook: Basic Storybook configuration (#1)
Browse files Browse the repository at this point in the history
* [WIP] Almost there. We just need to fix ThemeDecorator

* Finish basic Storybook configuration
  • Loading branch information
svallory authored Dec 12, 2023
1 parent eef5ad1 commit ec394b0
Show file tree
Hide file tree
Showing 127 changed files with 7,148 additions and 247 deletions.
10 changes: 10 additions & 0 deletions .storybook/decorators/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* This file is automatically generated!
*
* To regenerate the index, press cmd+shift+p then run the command
* "Generate Index"
*/

// @index('./*', f => `export { default as ${f.name} } from "${f.path}";`);
export { default as themes } from "./themes";
// @endindex
12 changes: 12 additions & 0 deletions .storybook/decorators/themes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { MarkoRenderer } from "@storybook/marko";
import { withThemeByDataAttribute } from "@storybook/addon-themes";

export default withThemeByDataAttribute<MarkoRenderer>({
themes: {
"Figma Light": "light",
"Figma Dark": "dark",
FigJam: "figjam",
},
defaultTheme: "Figma Light",
attributeName: "data-theme",
});
25 changes: 25 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import type { StorybookConfig } from "@storybook/marko-vite";

export default {
stories: [
// "../stories/**/*.mdx",
"../stories/**/*.stories.@(js|mjs|cjs|ts|mts|cts|marko)",
"../src/**/*.stories.@(js|mjs|cjs|ts|mts|cts|marko)",
],
addons: [
"@storybook/addon-essentials",
"@storybook/addon-themes",
"@storybook/addon-designs",
"@storybook/addon-docs",
"@storybook/addon-links",
"@storybook/addon-interactions",
"@storybook/addon-storysource",
],
framework: {
name: "@storybook/marko-vite",
options: {},
},
docs: {
autodocs: "tag",
},
} satisfies StorybookConfig;
22 changes: 22 additions & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import type { Preview, MarkoRenderer } from "@storybook/marko";

import "../src/global.css";

import "../src/themes/index.css";

import * as decorators from "./decorators";

export default {
decorators: [decorators.themes],
parameters: {
actions: { argTypesRegex: "^on[A-Z].*" },
layout: "centered",

controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
},
} satisfies Preview;
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"jayfong.generate-index"
]
}
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"cSpell.words": [
"endindex",
"figjam",
"marko"
]
}
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,45 @@ This project is powered by [@marko/run](https://github.com/marko-js/run).
Pages map to the directory structure. You can add additional pages by creating files/directories under `src/routes` with `+page.marko` files.
Learn more in the [`@marko/run` docs](https://github.com/marko-js/run/#file-based-routing).

# To Do

## Configure Addons

### Documentation

- [ ] [`@storybook/addon-docs`](https://storybook.js.org/addons/@storybook/addon-docs/):

> Document component usage and properties in Markdown
- [ ] [`storybook-addon-docs-tabs`](https://storybook.js.org/addons/storybook-addon-docs-tabs):

> A Storybook addon that adds tabs to the Docs Addon.
![](https://raw.githubusercontent.com/cliedelt/storybook-addon-docs-tabs/HEAD/screenshot.png)

- [ ] [`@storybook/addon-storysource`](https://storybook.js.org/addons/@storybook/addon-storysource/):

> View a story’s source code to see how it works and paste into your app
![addon storysource preview](https://raw.githubusercontent.com/storybookjs/storybook/next/code/addons/storysource/docs/demo.gif)

### Versioning and Publishing

- [ ] Configure component statuses for [@etchteam/storybook-addon-status](https://github.com/etchteam/storybook-addon-status)

### Prototyping

- [ ] Configure [@storybook/addon-links](https://storybook.js.org/addons/@storybook/addon-links/)

> The Storybook Links addon can be used to create links that navigate between stories in Storybook.
### Speeding up Development

- [ ] [Create a custom ChatGPT to create stories](https://storybook.js.org/blog/build-your-own-storybook-gpt/)

- [ ] [storybook-vscode-component](https://storybook.js.org/addons/storybook-vscode-component)

> A simple Storybook addon to open the component source in VS Code
- [ ] [@storybook/addon-designs](https://storybookjs.github.io/addon-designs/?path=/docs/docs-quick-start--docs)
> Storybook addon for embedding your design preview in addon panel
1 change: 1 addition & 0 deletions icons/adjust.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/alert.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/angle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/arrow-left-right.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/arrow-up-down.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/auto-layout-horizontal.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/auto-layout-vertical.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/back.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/blend-empty.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/blend.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/break.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/caret-down.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/caret-left.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/caret-right.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/caret-up.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/check.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/close.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/component.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/corner-radius.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/corners.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/distribute-horizontal-spacing.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/distribute-vertical-spacing.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/draft.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/effects.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/ellipses.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/eyedropper.svg
1 change: 1 addition & 0 deletions icons/forward.svg
1 change: 1 addition & 0 deletions icons/frame.svg
1 change: 1 addition & 0 deletions icons/group.svg
1 change: 1 addition & 0 deletions icons/hidden.svg
1 change: 1 addition & 0 deletions icons/horizontal-padding.svg
1 change: 1 addition & 0 deletions icons/hyperlink.svg
1 change: 1 addition & 0 deletions icons/image.svg
Loading

0 comments on commit ec394b0

Please sign in to comment.