From d431e86dec3f080d986fcb50f404f53ff5ab9033 Mon Sep 17 00:00:00 2001 From: Kevin Heis Date: Mon, 30 Aug 2021 13:34:14 -0700 Subject: [PATCH] Storybook lite (#21040) * Remove storybook * Update index.js * Start a storybook outline * Start a storybook outline * Start showing errors * Update storybook.tsx * Typescript lint * Name field * Responsive * Update storybook.tsx * Update storybook.tsx * Update storybook.tsx * Add BumpLink to storybook * Update storybook.tsx --- components/ui/BumpLink/BumpLink.tsx | 5 ++- components/ui/Callout/Callout.tsx | 10 ++++- middleware/render-page.js | 4 ++ pages/storybook.tsx | 68 +++++++++++++++++++++++++++++ 4 files changed, 83 insertions(+), 4 deletions(-) create mode 100644 pages/storybook.tsx diff --git a/components/ui/BumpLink/BumpLink.tsx b/components/ui/BumpLink/BumpLink.tsx index 06492b9604..d5a69d365a 100644 --- a/components/ui/BumpLink/BumpLink.tsx +++ b/components/ui/BumpLink/BumpLink.tsx @@ -3,14 +3,15 @@ import cx from 'classnames' import styles from './BumpLink.module.scss' -type Props = { +export type BumpLinkPropsT = { children?: ReactNode title: ReactElement | string href: string as?: ElementType<{ className?: string; href: string }> className?: string } -export const BumpLink = ({ as, children, href, title, className }: Props) => { + +export const BumpLink = ({ as, children, href, title, className }: BumpLinkPropsT) => { const Component = as || 'a' const symbol = diff --git a/components/ui/Callout/Callout.tsx b/components/ui/Callout/Callout.tsx index 6d4cf50dc0..21e1d36728 100644 --- a/components/ui/Callout/Callout.tsx +++ b/components/ui/Callout/Callout.tsx @@ -2,13 +2,19 @@ import { DOMAttributes, ReactNode } from 'react' import cx from 'classnames' import styles from './Callout.module.scss' -type Props = { +export type CalloutPropsT = { dangerouslySetInnerHTML?: DOMAttributes['dangerouslySetInnerHTML'] variant: 'success' | 'info' | 'warning' children?: ReactNode className?: string } -export const Callout = ({ variant, className, dangerouslySetInnerHTML, children }: Props) => { + +export const Callout = ({ + variant, + className, + dangerouslySetInnerHTML, + children, +}: CalloutPropsT) => { return (
+

GitHub Docs Storybook

+

This page lists React components unique to the GitHub docs.

+
+ +
+ {stories.map(({ name, component, variants }) => ( +
+

{name}

+ {variants.map((props) => ( +
+ {/* @ts-ignore */} + {React.createElement(component, props)} +
+                    {JSON.stringify(props, null, 2)}
+                  
+
+ ))} +
+ ))} +
+
+
+ ) +}