mirror of
https://github.com/snachodog/just-the-docs.git
synced 2025-09-13 05:13:33 -06:00
First draft: add chromatic/storybook
This commit is contained in:
11
stories/ui-components/Button.js
Normal file
11
stories/ui-components/Button.js
Normal file
@@ -0,0 +1,11 @@
|
||||
import "../../_site/assets/css/just-the-docs-default.css"
|
||||
|
||||
export const createButton = ({ variant = "default", label, size = "4" }) => {
|
||||
const btn = document.createElement("button")
|
||||
btn.type = "button"
|
||||
btn.innerText = label
|
||||
|
||||
btn.className = ["btn", `btn-${variant}`, `fs-${size}`].join(" ")
|
||||
|
||||
return btn
|
||||
}
|
68
stories/ui-components/Button.stories.js
Normal file
68
stories/ui-components/Button.stories.js
Normal file
@@ -0,0 +1,68 @@
|
||||
import { createButton } from "./Button"
|
||||
|
||||
export default {
|
||||
title: "UI Components/Button",
|
||||
tags: ["autodocs"],
|
||||
render: ({ label, ...args }) => {
|
||||
return createButton({ label, ...args })
|
||||
},
|
||||
argTypes: {
|
||||
label: { control: "text" },
|
||||
size: {
|
||||
control: { type: "select" },
|
||||
options: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
|
||||
},
|
||||
variant: {
|
||||
control: { type: "select" },
|
||||
options: ["default", "primary", "purple", "blue", "green", "outline"],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
export const Default = {
|
||||
args: {
|
||||
variant: "default",
|
||||
label: "Button",
|
||||
size: 4,
|
||||
},
|
||||
}
|
||||
|
||||
export const Primary = {
|
||||
args: {
|
||||
variant: "primary",
|
||||
label: "Button",
|
||||
size: 4,
|
||||
},
|
||||
}
|
||||
|
||||
export const Purple = {
|
||||
args: {
|
||||
variant: "purple",
|
||||
label: "Button",
|
||||
size: 4,
|
||||
},
|
||||
}
|
||||
|
||||
export const Blue = {
|
||||
args: {
|
||||
variant: "blue",
|
||||
label: "Button",
|
||||
size: 4,
|
||||
},
|
||||
}
|
||||
|
||||
export const Green = {
|
||||
args: {
|
||||
variant: "green",
|
||||
label: "Button",
|
||||
size: 4,
|
||||
},
|
||||
}
|
||||
|
||||
export const Outline = {
|
||||
args: {
|
||||
variant: "outline",
|
||||
label: "Button",
|
||||
size: 4,
|
||||
},
|
||||
}
|
10
stories/ui-components/Label.js
Normal file
10
stories/ui-components/Label.js
Normal file
@@ -0,0 +1,10 @@
|
||||
import "../../_site/assets/css/just-the-docs-default.css"
|
||||
|
||||
export const createLabel = ({ variant = "default", label, size = "4" }) => {
|
||||
const btn = document.createElement("span")
|
||||
btn.innerText = label
|
||||
|
||||
btn.className = ["label", `label-${variant}`, `fs-${size}`].join(" ")
|
||||
|
||||
return btn
|
||||
}
|
68
stories/ui-components/Label.stories.js
Normal file
68
stories/ui-components/Label.stories.js
Normal file
@@ -0,0 +1,68 @@
|
||||
import { createLabel } from "./Label"
|
||||
|
||||
export default {
|
||||
title: "UI Components/Label",
|
||||
tags: ["autodocs"],
|
||||
render: ({ label, ...args }) => {
|
||||
return createLabel({ label, ...args })
|
||||
},
|
||||
argTypes: {
|
||||
label: { control: "text" },
|
||||
size: {
|
||||
control: { type: "select" },
|
||||
options: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
|
||||
},
|
||||
variant: {
|
||||
control: { type: "select" },
|
||||
options: ["default", "purple", "blue", "green", "red", "yellow"],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
export const Default = {
|
||||
args: {
|
||||
variant: "default",
|
||||
label: "Label",
|
||||
size: 4,
|
||||
},
|
||||
}
|
||||
|
||||
export const Purple = {
|
||||
args: {
|
||||
variant: "purple",
|
||||
label: "Label",
|
||||
size: 4,
|
||||
},
|
||||
}
|
||||
|
||||
export const Blue = {
|
||||
args: {
|
||||
variant: "blue",
|
||||
label: "Label",
|
||||
size: 4,
|
||||
},
|
||||
}
|
||||
|
||||
export const Green = {
|
||||
args: {
|
||||
variant: "green",
|
||||
label: "Label",
|
||||
size: 4,
|
||||
},
|
||||
}
|
||||
|
||||
export const Red = {
|
||||
args: {
|
||||
variant: "red",
|
||||
label: "Label",
|
||||
size: 4,
|
||||
},
|
||||
}
|
||||
|
||||
export const Yellow = {
|
||||
args: {
|
||||
variant: "yellow",
|
||||
label: "Label",
|
||||
size: 4,
|
||||
},
|
||||
}
|
Reference in New Issue
Block a user