diff --git a/react-ui/.storybook/main.ts b/react-ui/.storybook/main.ts new file mode 100644 index 00000000..551aa73b --- /dev/null +++ b/react-ui/.storybook/main.ts @@ -0,0 +1,61 @@ +import type { StorybookConfig } from '@storybook/react-webpack5'; +import path from 'path'; +import webpack from 'webpack'; + +const config: StorybookConfig = { + stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'], + addons: [ + '@storybook/addon-webpack5-compiler-swc', + '@storybook/addon-onboarding', + '@storybook/addon-essentials', + '@chromatic-com/storybook', + '@storybook/addon-interactions', + '@storybook/addon-styling-webpack', + ], + framework: { + name: '@storybook/react-webpack5', + options: {}, + }, + webpackFinal: async (config) => { + if (config.resolve) { + config.resolve.alias = { + ...config.resolve.alias, + '@': path.resolve(__dirname, '../src'), + // '@@': path.resolve(__dirname, '../src/.umi'), + // '@umijs/max': + // '/Users/cp3hnu/Documents/company/ci4sManagement-cloud/react-ui/node_modules/umi', + }; + } + if (config.module && config.module.rules) { + config.module.rules.push({ + test: /\.less$/, + use: [ + 'style-loader', + 'css-loader', + { + loader: 'less-loader', + options: { + lessOptions: { + javascriptEnabled: true, // 如果需要支持 Ant Design 的 Less 变量,开启此项 + modifyVars: { + hack: 'true; @import "@/styles/theme.less";', + }, + }, + }, + }, + ], + include: path.resolve(__dirname, '../src'), // 限制范围,避免处理 node_modules + }); + } + if (config.plugins) { + config.plugins.push( + new webpack.ProvidePlugin({ + React: 'react', // 全局注入 React + }), + ); + } + + return config; + }, +}; +export default config; diff --git a/react-ui/.storybook/preview.tsx b/react-ui/.storybook/preview.tsx new file mode 100644 index 00000000..9e8c4b60 --- /dev/null +++ b/react-ui/.storybook/preview.tsx @@ -0,0 +1,32 @@ +import '@/global.less'; +import '@/overrides.less'; +import type { Preview } from '@storybook/react'; +import { ConfigProvider } from 'antd'; +import zhCN from 'antd/locale/zh_CN'; +import React from 'react'; +import { BrowserRouter as Router } from 'react-router-dom'; +import './storybook.css'; + +const preview: Preview = { + parameters: { + controls: { + matchers: { + color: /(background|color)$/i, + date: /Date$/i, + }, + }, + }, + decorators: [ + (Story) => ( + + + + + + + + ), + ], +}; + +export default preview; diff --git a/react-ui/.storybook/storybook.css b/react-ui/.storybook/storybook.css new file mode 100644 index 00000000..0084b0f8 --- /dev/null +++ b/react-ui/.storybook/storybook.css @@ -0,0 +1,12 @@ +html, +body, +#root { + min-width: unset; + height: 100%; + margin: 0; + padding: 0; + overflow-y: visible; + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, + 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', + 'Noto Color Emoji'; +} diff --git a/react-ui/package.json b/react-ui/package.json index dc5be1c5..9e28858d 100644 --- a/react-ui/package.json +++ b/react-ui/package.json @@ -39,7 +39,9 @@ "test": "jest", "test:coverage": "npm run jest -- --coverage", "test:update": "npm run jest -- -u", - "tsc": "tsc --noEmit" + "tsc": "tsc --noEmit", + "storybook": "storybook dev -p 6006", + "build-storybook": "storybook build" }, "lint-staged": { "**/*.{js,jsx,ts,tsx}": "npm run lint-staged:js", @@ -83,6 +85,16 @@ }, "devDependencies": { "@ant-design/pro-cli": "^3.1.0", + "@chromatic-com/storybook": "~3.2.4", + "@storybook/addon-essentials": "~8.5.3", + "@storybook/addon-interactions": "~8.5.3", + "@storybook/addon-onboarding": "~8.5.3", + "@storybook/addon-styling-webpack": "~1.0.1", + "@storybook/addon-webpack5-compiler-swc": "~2.0.0", + "@storybook/blocks": "~8.5.3", + "@storybook/react": "~8.5.3", + "@storybook/react-webpack5": "~8.5.3", + "@storybook/test": "~8.5.3", "@testing-library/react": "^14.0.0", "@types/antd": "^1.0.0", "@types/express": "^4.17.14", @@ -96,14 +108,18 @@ "@umijs/max": "^4.0.66", "cross-env": "^7.0.3", "eslint": "^8.39.0", + "eslint-plugin-storybook": "~0.11.2", "express": "^4.18.2", "gh-pages": "^5.0.0", "husky": "^8.0.3", "jest": "^29.5.0", "jest-environment-jsdom": "^29.5.0", + "less": "~4.2.2", + "less-loader": "~12.2.0", "lint-staged": "^13.2.0", "mockjs": "^1.1.0", "prettier": "^2.8.1", + "storybook": "~8.5.3", "swagger-ui-dist": "^4.18.2", "ts-node": "^10.9.1", "typescript": "^5.0.4", diff --git a/react-ui/src/components/DisabledInput/index.tsx b/react-ui/src/components/DisabledInput/index.tsx index c951324e..3a31def8 100644 --- a/react-ui/src/components/DisabledInput/index.tsx +++ b/react-ui/src/components/DisabledInput/index.tsx @@ -6,6 +6,9 @@ type DisabledInputProps = { valuePropName?: string; }; +/** + * 模拟禁用的输入框,但是完全显示内容 + */ function DisabledInput({ value, valuePropName }: DisabledInputProps) { const data = valuePropName ? value[valuePropName] : value; return ( diff --git a/react-ui/src/stories/BasicInfo.stories.tsx b/react-ui/src/stories/BasicInfo.stories.tsx new file mode 100644 index 00000000..f015096c --- /dev/null +++ b/react-ui/src/stories/BasicInfo.stories.tsx @@ -0,0 +1,86 @@ +import BasicInfo from '@/components/BasicInfo'; +import { formatDate } from '@/utils/date'; +import type { Meta, StoryObj } from '@storybook/react'; +import { Button } from 'antd'; + +const formatList = (value: string[] | null | undefined): string => { + if ( + value === undefined || + value === null || + Array.isArray(value) === false || + value.length === 0 + ) { + return '--'; + } + return value.join(','); +}; + +// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export +const meta = { + title: 'Components/BasicInfo', + component: BasicInfo, + parameters: { + // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout + // layout: 'centered', + }, + // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs + tags: ['autodocs'], + // More on argTypes: https://storybook.js.org/docs/api/argtypes + argTypes: { + // backgroundColor: { control: 'color' }, + }, + // Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args + // args: { onClick: fn() }, +} satisfies Meta; + +export default meta; +type Story = StoryObj; + +// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args +export const Primary: Story = { + args: { + datas: [ + { label: '服务名称', value: '手写体识别' }, + { + label: '无数据', + value: '', + }, + { + label: '外部链接', + value: 'https://www.baidu.com/', + format: (value: string) => { + return { + value: '百度', + url: value, + }; + }, + }, + { + label: '内部链接', + value: 'https://www.baidu.com/', + format: () => { + return { + value: '实验', + link: '/pipeline/experiment/instance/1/1', + }; + }, + }, + { label: '日期', value: new Date(), format: formatDate }, + { label: '数组', value: ['a', 'b'], format: formatList }, + { + label: '带省略号', + value: '这是一个很长的字符串这是一个很长的字符串这是一个很长的字符串这是一个很长的字符串', + }, + + { + label: '自定义组件', + value: ( + + ), + }, + ], + labelWidth: 100, + }, +}; diff --git a/react-ui/src/stories/BasicTableInfo.stories.tsx b/react-ui/src/stories/BasicTableInfo.stories.tsx new file mode 100644 index 00000000..36eb13ae --- /dev/null +++ b/react-ui/src/stories/BasicTableInfo.stories.tsx @@ -0,0 +1,85 @@ +import BasicTableInfo from '@/components/BasicTableInfo'; +import { formatDate } from '@/utils/date'; +import type { Meta, StoryObj } from '@storybook/react'; +import { Button } from 'antd'; + +const formatList = (value: string[] | null | undefined): string => { + if ( + value === undefined || + value === null || + Array.isArray(value) === false || + value.length === 0 + ) { + return '--'; + } + return value.join(','); +}; + +// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export +const meta = { + title: 'Components/BasicTableInfo', + component: BasicTableInfo, + parameters: { + // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout + // layout: 'centered', + }, + // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs + tags: ['autodocs'], + // More on argTypes: https://storybook.js.org/docs/api/argtypes + argTypes: { + // backgroundColor: { control: 'color' }, + }, + // Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args + // args: { onClick: fn() }, +} satisfies Meta; + +export default meta; +type Story = StoryObj; + +// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args +export const Primary: Story = { + args: { + datas: [ + { label: '服务名称', value: '手写体识别' }, + { + label: '无数据', + value: '', + }, + { + label: '外部链接', + value: 'https://www.baidu.com/', + format: (value: string) => { + return { + value: '百度', + url: value, + }; + }, + }, + { + label: '内部链接', + value: 'https://www.baidu.com/', + format: () => { + return { + value: '实验', + link: '/pipeline/experiment/instance/1/1', + }; + }, + }, + { label: '日期', value: new Date(), format: formatDate }, + { label: '数组', value: ['a', 'b'], format: formatList }, + { + label: '带省略号', + value: '这是一个很长的字符串这是一个很长的字符串这是一个很长的字符串这是一个很长的字符串', + }, + { + label: '自定义组件', + value: ( +
+ +
+ ), + }, + ], + labelWidth: 70, + }, +}; diff --git a/react-ui/src/stories/example/Button.stories.ts b/react-ui/src/stories/example/Button.stories.ts new file mode 100644 index 00000000..2a05e01b --- /dev/null +++ b/react-ui/src/stories/example/Button.stories.ts @@ -0,0 +1,53 @@ +import type { Meta, StoryObj } from '@storybook/react'; +import { fn } from '@storybook/test'; + +import { Button } from './Button'; + +// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export +const meta = { + title: 'Example/Button', + component: Button, + parameters: { + // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout + layout: 'centered', + }, + // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs + tags: ['autodocs'], + // More on argTypes: https://storybook.js.org/docs/api/argtypes + argTypes: { + backgroundColor: { control: 'color' }, + }, + // Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args + args: { onClick: fn() }, +} satisfies Meta; + +export default meta; +type Story = StoryObj; + +// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args +export const Primary: Story = { + args: { + primary: true, + label: 'Button', + }, +}; + +export const Secondary: Story = { + args: { + label: 'Button', + }, +}; + +export const Large: Story = { + args: { + size: 'large', + label: 'Button', + }, +}; + +export const Small: Story = { + args: { + size: 'small', + label: 'Button', + }, +}; diff --git a/react-ui/src/stories/example/Button.tsx b/react-ui/src/stories/example/Button.tsx new file mode 100644 index 00000000..f35dafdc --- /dev/null +++ b/react-ui/src/stories/example/Button.tsx @@ -0,0 +1,37 @@ +import React from 'react'; + +import './button.css'; + +export interface ButtonProps { + /** Is this the principal call to action on the page? */ + primary?: boolean; + /** What background color to use */ + backgroundColor?: string; + /** How large should the button be? */ + size?: 'small' | 'medium' | 'large'; + /** Button contents */ + label: string; + /** Optional click handler */ + onClick?: () => void; +} + +/** Primary UI component for user interaction */ +export const Button = ({ + primary = false, + size = 'medium', + backgroundColor, + label, + ...props +}: ButtonProps) => { + const mode = primary ? 'storybook-button--primary' : 'storybook-button--secondary'; + return ( + + ); +}; diff --git a/react-ui/src/stories/example/Configure.mdx b/react-ui/src/stories/example/Configure.mdx new file mode 100644 index 00000000..6a537304 --- /dev/null +++ b/react-ui/src/stories/example/Configure.mdx @@ -0,0 +1,364 @@ +import { Meta } from "@storybook/blocks"; + +import Github from "./assets/github.svg"; +import Discord from "./assets/discord.svg"; +import Youtube from "./assets/youtube.svg"; +import Tutorials from "./assets/tutorials.svg"; +import Styling from "./assets/styling.png"; +import Context from "./assets/context.png"; +import Assets from "./assets/assets.png"; +import Docs from "./assets/docs.png"; +import Share from "./assets/share.png"; +import FigmaPlugin from "./assets/figma-plugin.png"; +import Testing from "./assets/testing.png"; +import Accessibility from "./assets/accessibility.png"; +import Theming from "./assets/theming.png"; +import AddonLibrary from "./assets/addon-library.png"; + +export const RightArrow = () => + + + + + +
+
+ # Configure your project + + Because Storybook works separately from your app, you'll need to configure it for your specific stack and setup. Below, explore guides for configuring Storybook with popular frameworks and tools. If you get stuck, learn how you can ask for help from our community. +
+
+
+ A wall of logos representing different styling technologies +

Add styling and CSS

+

Like with web applications, there are many ways to include CSS within Storybook. Learn more about setting up styling within Storybook.

+ Learn more +
+
+ An abstraction representing the composition of data for a component +

Provide context and mocking

+

Often when a story doesn't render, it's because your component is expecting a specific environment or context (like a theme provider) to be available.

+ Learn more +
+
+ A representation of typography and image assets +
+

Load assets and resources

+

To link static files (like fonts) to your projects and stories, use the + `staticDirs` configuration option to specify folders to load when + starting Storybook.

+ Learn more +
+
+
+
+
+
+ # Do more with Storybook + + Now that you know the basics, let's explore other parts of Storybook that will improve your experience. This list is just to get you started. You can customise Storybook in many ways to fit your needs. +
+ +
+
+
+ A screenshot showing the autodocs tag being set, pointing a docs page being generated +

Autodocs

+

Auto-generate living, + interactive reference documentation from your components and stories.

+ Learn more +
+
+ A browser window showing a Storybook being published to a chromatic.com URL +

Publish to Chromatic

+

Publish your Storybook to review and collaborate with your entire team.

+ Learn more +
+
+ Windows showing the Storybook plugin in Figma +

Figma Plugin

+

Embed your stories into Figma to cross-reference the design and live + implementation in one place.

+ Learn more +
+
+ Screenshot of tests passing and failing +

Testing

+

Use stories to test a component in all its variations, no matter how + complex.

+ Learn more +
+
+ Screenshot of accessibility tests passing and failing +

Accessibility

+

Automatically test your components for a11y issues as you develop.

+ Learn more +
+
+ Screenshot of Storybook in light and dark mode +

Theming

+

Theme Storybook's UI to personalize it to your project.

+ Learn more +
+
+
+
+
+
+

Addons

+

Integrate your tools with Storybook to connect workflows.

+ Discover all addons +
+
+ Integrate your tools with Storybook to connect workflows. +
+
+ +
+
+ Github logo + Join our contributors building the future of UI development. + + Star on GitHub +
+
+ Discord logo +
+ Get support and chat with frontend developers. + + Join Discord server +
+
+
+ Youtube logo +
+ Watch tutorials, feature previews and interviews. + + Watch on YouTube +
+
+
+ A book +

Follow guided walkthroughs on for key workflows.

+ + Discover tutorials +
+
+ + diff --git a/react-ui/src/stories/example/Header.stories.ts b/react-ui/src/stories/example/Header.stories.ts new file mode 100644 index 00000000..80c71d0f --- /dev/null +++ b/react-ui/src/stories/example/Header.stories.ts @@ -0,0 +1,33 @@ +import type { Meta, StoryObj } from '@storybook/react'; +import { fn } from '@storybook/test'; + +import { Header } from './Header'; + +const meta = { + title: 'Example/Header', + component: Header, + // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs + tags: ['autodocs'], + parameters: { + // More on how to position stories at: https://storybook.js.org/docs/configure/story-layout + layout: 'fullscreen', + }, + args: { + onLogin: fn(), + onLogout: fn(), + onCreateAccount: fn(), + }, +} satisfies Meta; + +export default meta; +type Story = StoryObj; + +export const LoggedIn: Story = { + args: { + user: { + name: 'Jane Doe', + }, + }, +}; + +export const LoggedOut: Story = {}; diff --git a/react-ui/src/stories/example/Header.tsx b/react-ui/src/stories/example/Header.tsx new file mode 100644 index 00000000..1bf981a4 --- /dev/null +++ b/react-ui/src/stories/example/Header.tsx @@ -0,0 +1,56 @@ +import React from 'react'; + +import { Button } from './Button'; +import './header.css'; + +type User = { + name: string; +}; + +export interface HeaderProps { + user?: User; + onLogin?: () => void; + onLogout?: () => void; + onCreateAccount?: () => void; +} + +export const Header = ({ user, onLogin, onLogout, onCreateAccount }: HeaderProps) => ( +
+
+
+ + + + + + + +

Acme

+
+
+ {user ? ( + <> + + Welcome, {user.name}! + +
+
+
+); diff --git a/react-ui/src/stories/example/Page.stories.ts b/react-ui/src/stories/example/Page.stories.ts new file mode 100644 index 00000000..5d2c688a --- /dev/null +++ b/react-ui/src/stories/example/Page.stories.ts @@ -0,0 +1,32 @@ +import type { Meta, StoryObj } from '@storybook/react'; +import { expect, userEvent, within } from '@storybook/test'; + +import { Page } from './Page'; + +const meta = { + title: 'Example/Page', + component: Page, + parameters: { + // More on how to position stories at: https://storybook.js.org/docs/configure/story-layout + layout: 'fullscreen', + }, +} satisfies Meta; + +export default meta; +type Story = StoryObj; + +export const LoggedOut: Story = {}; + +// More on component testing: https://storybook.js.org/docs/writing-tests/component-testing +export const LoggedIn: Story = { + play: async ({ canvasElement }) => { + const canvas = within(canvasElement); + const loginButton = canvas.getByRole('button', { name: /Log in/i }); + await expect(loginButton).toBeInTheDocument(); + await userEvent.click(loginButton); + await expect(loginButton).not.toBeInTheDocument(); + + const logoutButton = canvas.getByRole('button', { name: /Log out/i }); + await expect(logoutButton).toBeInTheDocument(); + }, +}; diff --git a/react-ui/src/stories/example/Page.tsx b/react-ui/src/stories/example/Page.tsx new file mode 100644 index 00000000..e1174830 --- /dev/null +++ b/react-ui/src/stories/example/Page.tsx @@ -0,0 +1,73 @@ +import React from 'react'; + +import { Header } from './Header'; +import './page.css'; + +type User = { + name: string; +}; + +export const Page: React.FC = () => { + const [user, setUser] = React.useState(); + + return ( +
+
setUser({ name: 'Jane Doe' })} + onLogout={() => setUser(undefined)} + onCreateAccount={() => setUser({ name: 'Jane Doe' })} + /> + +
+

Pages in Storybook

+

+ We recommend building UIs with a{' '} + + component-driven + {' '} + process starting with atomic components and ending with pages. +

+

+ Render pages with mock data. This makes it easy to build and review page states without + needing to navigate to them in your app. Here are some handy patterns for managing page + data in Storybook: +

+
    +
  • + Use a higher-level connected component. Storybook helps you compose such data from the + "args" of child component stories +
  • +
  • + Assemble data in the page component from your services. You can mock these services out + using Storybook. +
  • +
+

+ Get a guided tutorial on component-driven development at{' '} + + Storybook tutorials + + . Read more in the{' '} + + docs + + . +

+
+ Tip Adjust the width of the canvas with the{' '} + + + + + + Viewports addon in the toolbar +
+
+
+ ); +}; diff --git a/react-ui/src/stories/example/assets/accessibility.png b/react-ui/src/stories/example/assets/accessibility.png new file mode 100644 index 00000000..6ffe6fea Binary files /dev/null and b/react-ui/src/stories/example/assets/accessibility.png differ diff --git a/react-ui/src/stories/example/assets/accessibility.svg b/react-ui/src/stories/example/assets/accessibility.svg new file mode 100644 index 00000000..107e93f8 --- /dev/null +++ b/react-ui/src/stories/example/assets/accessibility.svg @@ -0,0 +1 @@ +Accessibility \ No newline at end of file diff --git a/react-ui/src/stories/example/assets/addon-library.png b/react-ui/src/stories/example/assets/addon-library.png new file mode 100644 index 00000000..95deb38a Binary files /dev/null and b/react-ui/src/stories/example/assets/addon-library.png differ diff --git a/react-ui/src/stories/example/assets/assets.png b/react-ui/src/stories/example/assets/assets.png new file mode 100644 index 00000000..cfba6817 Binary files /dev/null and b/react-ui/src/stories/example/assets/assets.png differ diff --git a/react-ui/src/stories/example/assets/avif-test-image.avif b/react-ui/src/stories/example/assets/avif-test-image.avif new file mode 100644 index 00000000..530709bc Binary files /dev/null and b/react-ui/src/stories/example/assets/avif-test-image.avif differ diff --git a/react-ui/src/stories/example/assets/context.png b/react-ui/src/stories/example/assets/context.png new file mode 100644 index 00000000..e5cd249a Binary files /dev/null and b/react-ui/src/stories/example/assets/context.png differ diff --git a/react-ui/src/stories/example/assets/discord.svg b/react-ui/src/stories/example/assets/discord.svg new file mode 100644 index 00000000..d638958b --- /dev/null +++ b/react-ui/src/stories/example/assets/discord.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/react-ui/src/stories/example/assets/docs.png b/react-ui/src/stories/example/assets/docs.png new file mode 100644 index 00000000..a749629d Binary files /dev/null and b/react-ui/src/stories/example/assets/docs.png differ diff --git a/react-ui/src/stories/example/assets/figma-plugin.png b/react-ui/src/stories/example/assets/figma-plugin.png new file mode 100644 index 00000000..8f79b08c Binary files /dev/null and b/react-ui/src/stories/example/assets/figma-plugin.png differ diff --git a/react-ui/src/stories/example/assets/github.svg b/react-ui/src/stories/example/assets/github.svg new file mode 100644 index 00000000..dc513528 --- /dev/null +++ b/react-ui/src/stories/example/assets/github.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/react-ui/src/stories/example/assets/share.png b/react-ui/src/stories/example/assets/share.png new file mode 100644 index 00000000..8097a370 Binary files /dev/null and b/react-ui/src/stories/example/assets/share.png differ diff --git a/react-ui/src/stories/example/assets/styling.png b/react-ui/src/stories/example/assets/styling.png new file mode 100644 index 00000000..d341e826 Binary files /dev/null and b/react-ui/src/stories/example/assets/styling.png differ diff --git a/react-ui/src/stories/example/assets/testing.png b/react-ui/src/stories/example/assets/testing.png new file mode 100644 index 00000000..d4ac39a0 Binary files /dev/null and b/react-ui/src/stories/example/assets/testing.png differ diff --git a/react-ui/src/stories/example/assets/theming.png b/react-ui/src/stories/example/assets/theming.png new file mode 100644 index 00000000..1535eb9b Binary files /dev/null and b/react-ui/src/stories/example/assets/theming.png differ diff --git a/react-ui/src/stories/example/assets/tutorials.svg b/react-ui/src/stories/example/assets/tutorials.svg new file mode 100644 index 00000000..b492a9c6 --- /dev/null +++ b/react-ui/src/stories/example/assets/tutorials.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/react-ui/src/stories/example/assets/youtube.svg b/react-ui/src/stories/example/assets/youtube.svg new file mode 100644 index 00000000..a7515d7e --- /dev/null +++ b/react-ui/src/stories/example/assets/youtube.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/react-ui/src/stories/example/button.css b/react-ui/src/stories/example/button.css new file mode 100644 index 00000000..4e3620b0 --- /dev/null +++ b/react-ui/src/stories/example/button.css @@ -0,0 +1,30 @@ +.storybook-button { + display: inline-block; + cursor: pointer; + border: 0; + border-radius: 3em; + font-weight: 700; + line-height: 1; + font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} +.storybook-button--primary { + background-color: #555ab9; + color: white; +} +.storybook-button--secondary { + box-shadow: rgba(0, 0, 0, 0.15) 0px 0px 0px 1px inset; + background-color: transparent; + color: #333; +} +.storybook-button--small { + padding: 10px 16px; + font-size: 12px; +} +.storybook-button--medium { + padding: 11px 20px; + font-size: 14px; +} +.storybook-button--large { + padding: 12px 24px; + font-size: 16px; +} diff --git a/react-ui/src/stories/example/header.css b/react-ui/src/stories/example/header.css new file mode 100644 index 00000000..5efd46c2 --- /dev/null +++ b/react-ui/src/stories/example/header.css @@ -0,0 +1,32 @@ +.storybook-header { + display: flex; + justify-content: space-between; + align-items: center; + border-bottom: 1px solid rgba(0, 0, 0, 0.1); + padding: 15px 20px; + font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.storybook-header svg { + display: inline-block; + vertical-align: top; +} + +.storybook-header h1 { + display: inline-block; + vertical-align: top; + margin: 6px 0 6px 10px; + font-weight: 700; + font-size: 20px; + line-height: 1; +} + +.storybook-header button + button { + margin-left: 10px; +} + +.storybook-header .welcome { + margin-right: 10px; + color: #333; + font-size: 14px; +} diff --git a/react-ui/src/stories/example/page.css b/react-ui/src/stories/example/page.css new file mode 100644 index 00000000..77c81d2d --- /dev/null +++ b/react-ui/src/stories/example/page.css @@ -0,0 +1,68 @@ +.storybook-page { + margin: 0 auto; + padding: 48px 20px; + max-width: 600px; + color: #333; + font-size: 14px; + line-height: 24px; + font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.storybook-page h2 { + display: inline-block; + vertical-align: top; + margin: 0 0 4px; + font-weight: 700; + font-size: 32px; + line-height: 1; +} + +.storybook-page p { + margin: 1em 0; +} + +.storybook-page a { + color: inherit; +} + +.storybook-page ul { + margin: 1em 0; + padding-left: 30px; +} + +.storybook-page li { + margin-bottom: 8px; +} + +.storybook-page .tip { + display: inline-block; + vertical-align: top; + margin-right: 10px; + border-radius: 1em; + background: #e7fdd8; + padding: 4px 12px; + color: #357a14; + font-weight: 700; + font-size: 11px; + line-height: 12px; +} + +.storybook-page .tip-wrapper { + margin-top: 40px; + margin-bottom: 40px; + font-size: 13px; + line-height: 20px; +} + +.storybook-page .tip-wrapper svg { + display: inline-block; + vertical-align: top; + margin-top: 3px; + margin-right: 4px; + width: 12px; + height: 12px; +} + +.storybook-page .tip-wrapper svg path { + fill: #1ea7fd; +}