From 842837fb4e31eb0719d83b43116765cff3f00929 Mon Sep 17 00:00:00 2001 From: Yangshun Tay Date: Tue, 4 Oct 2022 09:04:08 +0800 Subject: [PATCH] storybook: add Button and Spinner examples --- apps/portal/src/pages/index.tsx | 4 +- apps/storybook/.storybook/main.js | 13 +- apps/storybook/.storybook/preview.js | 5 + apps/storybook/package.json | 4 + apps/storybook/postcss.config.js | 9 +- apps/storybook/stories/button.stories.tsx | 252 ++++++++++++++++-- .../stories/counterbutton.stories.mdx | 20 -- apps/storybook/stories/spinner.stories.tsx | 57 ++++ apps/storybook/tailwind.config.js | 7 + packages/ui/package.json | 1 + packages/ui/src/Button/Button.tsx | 6 +- packages/ui/src/CounterButton.tsx | 42 --- packages/ui/src/NewTabLink.tsx | 15 -- packages/ui/src/index.tsx | 4 +- yarn.lock | 15 +- 15 files changed, 339 insertions(+), 115 deletions(-) delete mode 100644 apps/storybook/stories/counterbutton.stories.mdx create mode 100644 apps/storybook/stories/spinner.stories.tsx create mode 100644 apps/storybook/tailwind.config.js delete mode 100644 packages/ui/src/CounterButton.tsx delete mode 100644 packages/ui/src/NewTabLink.tsx diff --git a/apps/portal/src/pages/index.tsx b/apps/portal/src/pages/index.tsx index 2aa0a8aa..9d39e2db 100644 --- a/apps/portal/src/pages/index.tsx +++ b/apps/portal/src/pages/index.tsx @@ -1,4 +1,4 @@ -import { Button, CounterButton } from '@tih/ui'; +import { Button, Spinner } from '@tih/ui'; export default function HomePage() { return ( @@ -8,8 +8,8 @@ export default function HomePage() {

Homepage

- - - - ); -} diff --git a/packages/ui/src/NewTabLink.tsx b/packages/ui/src/NewTabLink.tsx deleted file mode 100644 index 86c240e8..00000000 --- a/packages/ui/src/NewTabLink.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import * as React from 'react'; -export function NewTabLink({ - children, - href, - ...other -}: { - children: React.ReactNode; - href: string; -}) { - return ( - - {children} - - ); -} diff --git a/packages/ui/src/index.tsx b/packages/ui/src/index.tsx index 00b92547..215b15fe 100644 --- a/packages/ui/src/index.tsx +++ b/packages/ui/src/index.tsx @@ -1,4 +1,4 @@ export { default as Button } from './Button'; export * from './Button'; -export { CounterButton } from './CounterButton'; -export { NewTabLink } from './NewTabLink'; +export { default as Spinner } from './Spinner'; +export * from './Spinner'; diff --git a/yarn.lock b/yarn.lock index c33d6b77..999d5e87 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2372,6 +2372,17 @@ regenerator-runtime "^0.13.7" ts-dedent "^2.0.0" +"@storybook/addon-postcss@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@storybook/addon-postcss/-/addon-postcss-2.0.0.tgz#ec61cb9bb2662f408072b35c466c7df801c28498" + integrity sha512-Nt82A7e9zJH4+A+VzLKKswUfru+T6FJTakj4dccP0i8DSn7a0CkzRPrLuZBq8tg4voV6gD74bcDf3gViCVBGtA== + dependencies: + "@storybook/node-logger" "^6.1.14" + css-loader "^3.6.0" + postcss "^7.0.35" + postcss-loader "^4.2.0" + style-loader "^1.3.0" + "@storybook/addon-toolbars@6.5.12": version "6.5.12" resolved "https://registry.yarnpkg.com/@storybook/addon-toolbars/-/addon-toolbars-6.5.12.tgz#ea81c63ae56eae8bc1d3b5a358cff66ae5a2d66e" @@ -2858,7 +2869,7 @@ prettier ">=2.2.1 <=2.3.0" ts-dedent "^2.0.0" -"@storybook/node-logger@6.5.12": +"@storybook/node-logger@6.5.12", "@storybook/node-logger@^6.1.14": version "6.5.12" resolved "https://registry.yarnpkg.com/@storybook/node-logger/-/node-logger-6.5.12.tgz#0f9efcd1a37c7aae493b22fe33cacca87c135b9b" integrity sha512-jdLtT3mX5GQKa+0LuX0q0sprKxtCGf6HdXlKZGD5FEuz4MgJUGaaiN0Hgi+U7Z4tVNOtSoIbYBYXHqfUgJrVZw== @@ -11442,7 +11453,7 @@ postcss@8.4.14: picocolors "^1.0.0" source-map-js "^1.0.2" -postcss@^7.0.14, postcss@^7.0.26, postcss@^7.0.32, postcss@^7.0.36, postcss@^7.0.5, postcss@^7.0.6: +postcss@^7.0.14, postcss@^7.0.26, postcss@^7.0.32, postcss@^7.0.35, postcss@^7.0.36, postcss@^7.0.5, postcss@^7.0.6: version "7.0.39" resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.39.tgz#9624375d965630e2e1f2c02a935c82a59cb48309" integrity sha512-yioayjNbHn6z1/Bywyb2Y4s3yvDAeXGOyxqD+LnVOinq6Mdmd++SW2wUNVzavyyHxd6+DxzWGIuosg6P1Rj8uA==