import React from 'react' import ReactDomServer from 'react-dom/server' import { BumpLink, BumpLinkPropsT } from 'components/ui/BumpLink/BumpLink' import { Callout, CalloutPropsT } from 'components/ui/Callout/Callout' import { Lead, LeadPropsT } from 'components/ui/Lead/Lead' import { MarkdownContent, MarkdownContentPropsT, } from 'components/ui/MarkdownContent/MarkdownContent' import { ScrollButton, ScrollButtonPropsT } from 'components/ui/ScrollButton/ScrollButton' import { TruncateLines, TruncateLinesPropsT } from 'components/ui/TruncateLines/TruncateLines' const markdownExample = ( <>

Header Level 1: Steps example

  1. Start with step 1
  2. Continue with step 2
  3. Finish with step 3

Header Level 2: Highlighted code example

      
        steps:
        {'\n'}
        - uses:{' '}
        actions/checkout@v2
        {'\n'}
        - uses:{' '}
        actions/setup-java@v2
        {'\n  '}
        with:
        {'\n    '}
        java-version: '11'
        {'\n    '}
        distribution:{' '}
        'adopt'
      
    

Header Level 3: Table example

Qualifier Example
sort:interactions or sort:interactions-desc org:github sort:interactions {' '} matches issues in repositories owned by GitHub, sorted by the highest combined number of reactions and comments.
sort:interactions-asc org:github sort:interactions-asc {' '} matches issues in repositories owned by GitHub, sorted by the lowest combined number of reactions and comments.

Header Level 4: Procedural image example

Group assignment ) // Trying to keep these alphabetical order const stories = [ { name: 'BumpLink', component: BumpLink, variants: [ { title: 'Think basic', href: 'http://example.com' } as BumpLinkPropsT, { title: 'Think different', href: 'http://example.com', children: 'This is child text', } as BumpLinkPropsT, { as: 'div', title: 'Think as div', href: 'http://example.com', className: 'color-bg-attention', } as BumpLinkPropsT, ], }, { name: 'Callout', component: Callout, variants: [ { variant: 'success', children: 'Yay you did it!', className: '' } as CalloutPropsT, { variant: 'info', children: 'Captain I have information.', className: '' } as CalloutPropsT, { variant: 'warning', children: 'Warning... warning...', className: '' } as CalloutPropsT, { variant: 'success', children: 'I am a little font', className: 'f6' } as CalloutPropsT, ], }, { name: 'Lead', component: Lead, variants: [ { children: 'Lead by example' } as LeadPropsT, { children: 'Lead by blue', className: 'color-bg-accent' } as LeadPropsT, { children: ( <> You can personalize Codespaces by using a dotfiles repository on GitHub. ), } as LeadPropsT, ], }, { name: 'MarkdownContent', component: MarkdownContent, variants: [{ children: markdownExample } as MarkdownContentPropsT], }, { name: 'ScrollButton', component: ScrollButton, variants: [{ className: '', ariaLabel: 'Scroll to top' } as ScrollButtonPropsT], }, { name: 'TruncateLines', component: TruncateLines, variants: [ { as: 'p', maxLines: 2, children: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.', className: 'color-bg-subtle', } as TruncateLinesPropsT, ], }, ] function displayProps(props: Object) { const xprops = Object.fromEntries( Object.entries(props).map(([key, value]) => [ key, key === 'children' ? ReactDomServer.renderToString(value) : value, ]) ) return JSON.stringify(xprops, null, 2) } export default function Storybook() { 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)}
                    {displayProps(props)}
                  
))}
))}
) }