Skip to content

Normalize & document icon usage, and move design documents into storybook #2597

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion frontend/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,14 @@ module.exports = {
typescript: true,
},
},
ignorePatterns: ["__generated__", "__mocks__", "dist", "docs"],
ignorePatterns: [
"__generated__",
"__mocks__",
"dist",
"docs",
"!.storybook",
"storybook-static",
],
overrides: [
{
extends: ["plugin:@typescript-eslint/disable-type-checked"],
Expand All @@ -162,5 +169,18 @@ module.exports = {
"@typescript-eslint/no-unsafe-call": "off",
},
},
{
files: [".storybook/**/*.tsx"],
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:import-x/recommended",
"plugin:storybook/recommended",
"prettier",
],
parserOptions: {
project: [".storybook/tsconfig.json"],
},
},
],
};
39 changes: 39 additions & 0 deletions frontend/.storybook/blocks/ColorSwatch.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import React from "react";

export const ColorSwatch = ({
color,
children,
}: {
color: string;
children: React.ReactNode;
}) => {
return (
<span
className="sb-unstyled inline-flex items-baseline ring-1"
style={
{
"--tw-ring-color": "rgb(236, 244, 249)",
"--tw-ring-inset": "inset",
paddingTop: 2,
paddingBottom: 2,
borderRadius: 5,
paddingRight: 2,
} as React.CSSProperties
}
>
{children}
<span
className="font-monospace inline-block self-center rounded-sm ring-1"
style={
{
width: 21,
height: 21,
backgroundColor: color,
"--tw-ring-color": "#0004",
"--tw-ring-inset": "inset",
} as React.CSSProperties
}
></span>
</span>
);
};
18 changes: 16 additions & 2 deletions frontend/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import path from "path";

import type { StorybookConfig } from "@storybook/web-components-webpack5";
import EslintWebpackPlugin from "eslint-webpack-plugin";
import remarkGfm from "remark-gfm";
import type { WebpackConfiguration } from "webpack-dev-server";

import {
Expand All @@ -15,6 +17,7 @@ const config: StorybookConfig = {
from: shoelaceAssetsSrcPath,
to: shoelaceAssetsPublicPath,
},
{ from: "../src/assets/", to: "/assets" },
],
addons: [
"@storybook/addon-webpack5-compiler-swc",
Expand Down Expand Up @@ -70,17 +73,27 @@ const config: StorybookConfig = {
],
},
},
{
name: "@storybook/addon-docs",
options: {
mdxPluginOptions: {
mdxCompileOptions: {
remarkPlugins: [remarkGfm],
},
},
},
},
],
framework: {
name: "@storybook/web-components-webpack5",
options: {},
},
webpackFinal: async (config) => {
// Show eslint errors from Storybook files in Webpack overlay
const ESLintPlugin = require("eslint-webpack-plugin");

config.plugins?.push(
new ESLintPlugin({
// @ts-expect-error something to do with different symbols - not totally sure, but doesn't seem to be a problem
new EslintWebpackPlugin({
files: ["**/stories/**/*.ts", "**/.storybook/*.ts"],
}),
);
Expand All @@ -98,6 +111,7 @@ const config: StorybookConfig = {
parser: {
syntax: "typescript",
decorators: true,
jsx: true,
},
// TODO Consolidate with tsconfig.json
transform: {
Expand Down
2 changes: 2 additions & 0 deletions frontend/.storybook/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
type Preview,
} from "@storybook/web-components";

import customElements from "@/__generated__/custom-elements.json";

Check failure on line 9 in frontend/.storybook/preview.ts

View workflow job for this annotation

GitHub Actions / Lint (20)

Unable to resolve path to module '@/__generated__/custom-elements.json'

Check failure on line 9 in frontend/.storybook/preview.ts

View workflow job for this annotation

GitHub Actions / Lint (22)

Unable to resolve path to module '@/__generated__/custom-elements.json'

import "../src/theme.stylesheet.css";

// Automatically document component properties
setCustomElementsManifest(customElements);

Expand Down
9 changes: 9 additions & 0 deletions frontend/.storybook/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"jsx": "react",
"resolveJsonModule": true,
"esModuleInterop": true,
},
"include": ["**/*.ts", "**/*.tsx"],
}
Binary file not shown.
Binary file removed frontend/docs/docs/assets/fonts/Inter.var.woff2
Binary file not shown.
Binary file not shown.
17 changes: 0 additions & 17 deletions frontend/docs/docs/develop/ui/design-action-menus.md

This file was deleted.

20 changes: 0 additions & 20 deletions frontend/docs/docs/develop/ui/design-status-icons.md

This file was deleted.

2 changes: 1 addition & 1 deletion frontend/docs/docs/develop/ui/storybook.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Using Storybook

[Storybook](https://storybook.js.org/) is a tool for documenting and building UI components in isolation. Component documentation is organized into ["stories"](https://storybook.js.org/docs/writing-stories) that show a variety of possible rendered states of a UI component.
[Storybook](https://storybook.js.org/) is a tool for documenting and building UI components and design systems in isolation. Component documentation is organized into ["stories"](https://storybook.js.org/docs/writing-stories) that show a variety of possible rendered states of a UI component.

Browsertrix component stories live in `frontend/src/stories`. Component attributes that are public properties (i.e. defined with Lit `@property({ type: Type })`) or documented in a TSDoc comment will automatically appear in stories through the [Custom Elements Manifest](https://custom-elements-manifest.open-wc.org/analyzer/getting-started/) file.

Expand Down

This file was deleted.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading