-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
/
Copy pathpageBanner.stories.tsx
127 lines (118 loc) · 4.06 KB
/
pageBanner.stories.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
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 = (
<LinkButton
external
href="https://sentry.io/orgredirect/organizations/:orgslug/stories"
priority="primary"
>
View Stories
</LinkButton>
);
story('Example', () => (
<Fragment>
<p>Here's an example Banner announcing this UI Component Library:</p>
<PageBanner
button={storiesButton}
description="Build new products faster by exploring reusable the UI components available inside Sentry."
heading="Introducing the UI Component Library"
icon={<IconBroadcast size="sm" />}
image={replaysDeadRageBackground}
title="UI Library Available"
/>
</Fragment>
));
story('Example with dismiss', () => {
const [isDismissed, setIsDismissed] = useState(false);
return (
<Fragment>
<p>
This example renders an X in the top-right corner. You can wire it up with
something like <kbd>useDismissAlert()</kbd>.
</p>
<p>
Is Dismissed? <var>{String(isDismissed)}</var>
</p>
{isDismissed ? (
<Button size="sm" onClick={() => setIsDismissed(false)}>
Show banner
</Button>
) : (
<PageBanner
button={storiesButton}
description="Build new products faster by exploring reusable the UI components available inside Sentry."
heading="Introducing the UI Component Library"
icon={<IconBroadcast size="sm" />}
image={replaysDeadRageBackground}
title="UI Library Available"
onDismiss={() => setIsDismissed(true)}
/>
)}
</Fragment>
);
});
story('Resizable', () => {
const [flexGrow, setFlexGrow] = useState(false);
return (
<Fragment>
<p>
The banner will resize if it's shrunk really narrow. To make it expand inside a
flex parent set <kbd>flex-grow:1</kbd>.
</p>
<p>
<Button size="sm" onClick={() => setFlexGrow(!flexGrow)}>
flexGrow: <var>{flexGrow ? 1 : 0}</var>
</Button>
</p>
<SizingWindow>
<PageBanner
style={{flexGrow: flexGrow ? 1 : 0}}
button={storiesButton}
description="Build new products faster by exploring reusable the UI components available inside Sentry."
heading="Introducing the UI Component Library"
icon={<IconBroadcast size="sm" />}
image={replaysDeadRageBackground}
title="UI Library Available"
/>
</SizingWindow>
</Fragment>
);
});
story('More variations', () => (
<Fragment>
<p>There are some examples where we change out the colors and mix things up:</p>
<PageBanner
button={storiesButton}
description={
<Fragment>
Build new products faster by exploring reusable the UI components available
inside Sentry.{' '}
<ExternalLink href="https://sentry.io/orgredirect/organizations/:orgslug/stories">
See stories
</ExternalLink>
</Fragment>
}
heading="Introducing the UI Component Library"
icon={<IconBroadcast size="sm" />}
image={replaysDeadRageBackground}
title={
<Fragment>
UI Library Available at <Green>https://sentry.io/stories</Green>
</Fragment>
}
/>
</Fragment>
));
});
const Green = styled('span')`
color: ${p => p.theme.green400};
font-weight: bold;
`;