This repository has been archived by the owner on Jun 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
71 changed files
with
189 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module.exports = { | ||
addons: [ | ||
"@storybook/addon-backgrounds/register", | ||
"@storybook/addon-knobs/register", | ||
"@storybook/addon-notes/register-panel" | ||
], | ||
presets: ["@storybook/addon-docs/preset"], | ||
stories: ["../src/**/*.stories.(mdx|ts)"] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { addDecorator, addParameters } from "@storybook/html"; | ||
import centered from "@storybook/addon-centered/html"; | ||
import theme from "./theme"; | ||
import { titlelessDocsPage } from "./utils"; | ||
addDecorator(centered); | ||
addParameters({ | ||
backgrounds: [{ name: "Light", value: "#f8f8f8", default: true }], | ||
options: { | ||
theme, | ||
storySort: (a, b) => { | ||
const sectionA = a[1].id.split("-")[0]; | ||
const sectionB = b[1].id.split("-")[0]; | ||
return sectionB.localeCompare(sectionA); | ||
} | ||
}, | ||
docs: { | ||
page: titlelessDocsPage, | ||
extractComponentDescription: (_component, { notes }) => { | ||
if (notes) { | ||
if (typeof notes === "string") { | ||
return notes; | ||
} | ||
return Object.keys(notes) | ||
.map((section) => notes[section]) | ||
.join("\n"); | ||
} | ||
return null; | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
const dirOptions = ["ltr", "rtl"]; | ||
const themeOptions = ["light", "dark"]; | ||
const positionOptions = ["start", "end"]; | ||
const scaleOptions = ["s", "m", "l"]; | ||
const appearanceOptions = ["solid", "clear", "outline"]; | ||
export const ATTRIBUTES = { | ||
dir: { | ||
values: dirOptions, | ||
defaultValue: dirOptions[0] | ||
}, | ||
theme: { | ||
values: themeOptions, | ||
defaultValue: themeOptions[0] | ||
}, | ||
scale: { | ||
values: scaleOptions, | ||
defaultValue: scaleOptions[1] | ||
}, | ||
position: { | ||
values: positionOptions, | ||
defaultValue: positionOptions[0] | ||
}, | ||
appearance: { | ||
values: appearanceOptions, | ||
defaultValue: appearanceOptions[0] | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { create } from "@storybook/theming"; | ||
import logo from "./logo.svg"; | ||
export default create({ | ||
base: "light", | ||
brandTitle: "Calcite App Components", | ||
brandUrl: "./", | ||
brandImage: logo, | ||
addonNotesTheme: { | ||
code: { | ||
whiteSpace: "normal" | ||
}, | ||
pre: { | ||
code: { | ||
whiteSpace: "pre" | ||
} | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import colors from "../node_modules/@esri/calcite-colors/colors.json"; | ||
import { DocsPage } from "@storybook/addon-docs/blocks"; | ||
export const darkBackground = [ | ||
{ | ||
name: "Dark", | ||
value: colors["blk-210"], | ||
default: true | ||
} | ||
]; | ||
/** | ||
* This transforms a component markdown to properly render in Storybook notes. | ||
*/ | ||
export const parseReadme = (content) => { | ||
return (content | ||
// markdown uses relative paths for component links | ||
.replace(/\.\.\//g, "https://github.com/Esri/calcite-app-components/tree/master/src/components/")); | ||
}; | ||
export const createComponentHTML = (tagName, attributes, contentHTML) => `<${tagName} ${attributes.map(({ name, value }) => `${name}="${value}"`).join(" ")}>${contentHTML}</${tagName}>`; | ||
export const titlelessDocsPage = () => DocsPage({ | ||
// no title since README already has one | ||
titleSlot: () => "" | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module.exports = async ({ config }) => { | ||
config.module.rules.push({ | ||
test: /\.ts$/, | ||
use: [ | ||
{ | ||
loader: require.resolve("awesome-typescript-loader"), | ||
options: { | ||
configFileName: "tsconfig-storybook.json" | ||
} | ||
} | ||
] | ||
}); | ||
config.resolve.extensions.push(".ts"); | ||
return config; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.