diff --git a/static/app/components/replays/pageBanner.stories.tsx b/static/app/components/replays/pageBanner.stories.tsx new file mode 100644 index 00000000000000..0c33c7f93d1464 --- /dev/null +++ b/static/app/components/replays/pageBanner.stories.tsx @@ -0,0 +1,127 @@ +import {Fragment, useState} from 'react'; +import styled from '@emotion/styled'; + +import replaysDeadRageBackground from 'sentry-images/spot/replay-dead-rage-changelog.svg'; + +import {Button, LinkButton} from 'sentry/components/button'; +import ExternalLink from 'sentry/components/links/externalLink'; +import PageBanner from 'sentry/components/replays/pageBanner'; +import SizingWindow from 'sentry/components/stories/sizingWindow'; +import {IconBroadcast} from 'sentry/icons'; +import storyBook from 'sentry/stories/storyBook'; + +export default storyBook('PageBanner', story => { + const storiesButton = ( + + View Stories + + ); + + story('Example', () => ( + +

Here's an example Banner announcing this UI Component Library:

+ } + image={replaysDeadRageBackground} + title="UI Library Available" + /> +
+ )); + + story('Example with dismiss', () => { + const [isDismissed, setIsDismissed] = useState(false); + + return ( + +

+ This example renders an X in the top-right corner. You can wire it up with + something like useDismissAlert(). +

+

+ Is Dismissed? {String(isDismissed)} +

+ {isDismissed ? ( + + ) : ( + } + image={replaysDeadRageBackground} + title="UI Library Available" + onDismiss={() => setIsDismissed(true)} + /> + )} +
+ ); + }); + + story('Resizable', () => { + const [flexGrow, setFlexGrow] = useState(false); + return ( + +

+ The banner will resize if it's shrunk really narrow. To make it expand inside a + flex parent set flex-grow:1. +

+

+ +

+ + } + image={replaysDeadRageBackground} + title="UI Library Available" + /> + +
+ ); + }); + + story('More variations', () => ( + +

There are some examples where we change out the colors and mix things up:

+ + Build new products faster by exploring reusable the UI components available + inside Sentry.{' '} + + See stories + +
+ } + heading="Introducing the UI Component Library" + icon={} + image={replaysDeadRageBackground} + title={ + + UI Library Available at https://sentry.io/stories + + } + /> + + )); +}); + +const Green = styled('span')` + color: ${p => p.theme.green400}; + font-weight: bold; +`; diff --git a/static/app/components/replays/pageBanner.tsx b/static/app/components/replays/pageBanner.tsx index 3b17efc6ac2188..d355de78ae4e2e 100644 --- a/static/app/components/replays/pageBanner.tsx +++ b/static/app/components/replays/pageBanner.tsx @@ -1,4 +1,4 @@ -import type {ReactNode} from 'react'; +import type {CSSProperties, ReactNode} from 'react'; import styled from '@emotion/styled'; import {Button} from 'sentry/components/button'; @@ -15,6 +15,7 @@ interface Props { title: ReactNode; button?: ReactNode; onDismiss?: () => void; + style?: CSSProperties; } export default function PageBanner({ @@ -25,9 +26,10 @@ export default function PageBanner({ image, onDismiss, title, + style, }: Props) { return ( - + {onDismiss && ( p.theme.subText}; - line-height: ${p => p.theme.fontSizeMedium}; font-size: ${p => p.theme.fontSizeMedium}; - align-items: center; - gap: ${space(0.5)}; + line-height: ${p => p.theme.fontSizeMedium}; `; const TypeText = styled(SubText)` - text-transform: uppercase; + align-items: center; + display: flex; font-weight: 500; + gap: ${space(0.5)}; + text-transform: uppercase; `;