import type {ComponentProps} from 'react'; import {Fragment} from 'react'; import styled from '@emotion/styled'; import {LinkButton} from 'sentry/components/button'; import {CopyToClipboardButton} from 'sentry/components/copyToClipboardButton'; import TextOverflow from 'sentry/components/textOverflow'; import {IconGithub} from 'sentry/icons'; import {t} from 'sentry/locale'; import {space} from 'sentry/styles/space'; import type {StoryDescriptor} from './useStoriesLoader'; interface Props extends ComponentProps<'div'> { story: StoryDescriptor; } export default function StoryFile({story, ...htmlProps}: Props) { return (

{story.filename}

); } export function StoryExports(props: {story: StoryDescriptor}) { const {default: DefaultExport, ...namedExports} = props.story.exports; return ( {DefaultExport ? ( ) : null} {Object.entries(namedExports).map(([name, MaybeComponent]) => { if (typeof MaybeComponent === 'function') { return ( ); } throw new Error( `Story exported an unsupported key ${name} with value: ${typeof MaybeComponent}` ); })} ); } function GithubLinks(props: {story: StoryDescriptor}) { return ( } size="xs" aria-label={t('View on GitHub')} > {t('View')} } size="xs" aria-label={t('Edit on GitHub')} > {t('Edit')} ); } const FlexRow = styled('div')` display: flex; flex-direction: row; flex-wrap: wrap; gap: var(--stories-grid-space); align-content: flex-start; `; const StoryLinksContainer = styled('div')` display: flex; flex-direction: row; flex-wrap: wrap; gap: ${space(1)}; align-content: flex-start; grid-area: header-links; `; const StoryFileLayout = styled('section')` padding-top: ${space(2)}; `; const Story = styled('section')` padding-top: ${space(2)}; `; const H2 = styled('h2')` font-family: ${p => p.theme.text.familyMono}; font-size: ${p => p.theme.fontSizeMedium}; font-weight: ${p => p.theme.fontWeightNormal}; margin: 0; `;