Skip to content

Commit 85f229d

Browse files
authored
chore: update component status page (#2023)
* chore: update toast component status page * chore: update * chore: update meta attribs for toast * Create angry-turtles-mate.md * chore: update component status with platform column
1 parent 573839f commit 85f229d

File tree

7 files changed

+126
-10
lines changed

7 files changed

+126
-10
lines changed

.changeset/angry-turtles-mate.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@razorpay/blade": patch
3+
---
4+
5+
refactor(blade): add meta attributes to Toast

packages/blade/src/components/Toast/Toast.stories.tsx

+16-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { Sandbox } from '~utils/storybook/Sandbox';
1313
import { Box } from '~components/Box';
1414
import { Button } from '~components/Button';
1515
import { Heading, Text } from '~components/Typography';
16+
import { List, ListItem, ListItemCode } from '~components/List';
1617

1718
const Page = (): React.ReactElement => {
1819
return (
@@ -93,8 +94,21 @@ const BasicToastTemplate: StoryFn<ToastProps> = (args) => {
9394

9495
return (
9596
<Box height="80vh">
96-
<Text marginBottom="spacing.3" color="surface.text.gray.subtle">
97-
After changing storybook controls, press the show "toast button" to see changes
97+
<Text size="medium" marginBottom="spacing.4">
98+
To start using toast simply:
99+
</Text>
100+
<List>
101+
<ListItem>
102+
Import and render the <ListItemCode>ToastContainer</ListItemCode> component from blade at
103+
the root of your project
104+
</ListItem>
105+
<ListItem>
106+
Utilize the methods exposed via <ListItemCode>useToast()</ListItemCode> hook to
107+
show/dismiss toasts
108+
</ListItem>
109+
</List>
110+
<Text marginY="spacing.4" color="surface.text.gray.muted">
111+
After changing storybook controls, press the "show toast" button to see changes
98112
</Text>
99113
<Button
100114
onClick={() => {

packages/blade/src/components/Toast/Toast.web.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { Text } from '~components/Typography';
2020
import { castWebType, makeMotionTime, useTheme } from '~utils';
2121
import getIn from '~utils/lodashButBetter/get';
2222
import { makeAccessible } from '~utils/makeAccessible';
23+
import { metaAttribute, MetaConstants } from '~utils/metaAttribute';
2324

2425
const iconMap = {
2526
positive: CheckCircleIcon,
@@ -119,6 +120,7 @@ const Toast = ({
119120
return (
120121
<AnimatedFade
121122
{...makeAccessible({ role: 'status', liveRegion: 'polite' })}
123+
{...metaAttribute({ name: MetaConstants.Toast })}
122124
toastBorderColor={getIn(
123125
theme.colors,
124126
isPromotional ? 'surface.border.gray.muted' : borderColorMap[color],

packages/blade/src/components/Toast/ToastContainer.web.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { makeMotionTime, makeSize, useTheme } from '~utils';
1919
import BaseBox from '~components/Box/BaseBox';
2020
import type { Theme } from '~components/BladeProvider';
2121
import { useIsMobile } from '~utils/useIsMobile';
22-
import { metaAttribute } from '~utils/metaAttribute';
22+
import { metaAttribute, MetaConstants } from '~utils/metaAttribute';
2323

2424
type CalculateYPositionProps = {
2525
toast: Toast;
@@ -230,6 +230,7 @@ const Toaster: React.FC<ToasterProps> = ({
230230
maxWidth={makeSize(TOAST_MAX_WIDTH)}
231231
pointerEvents="none"
232232
className={containerClassName}
233+
{...metaAttribute({ name: MetaConstants.ToastContainer })}
233234
>
234235
{/*
235236
* Mouseover container,

packages/blade/src/utils/metaAttribute/metaConstants.ts

+2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ export const MetaConstants = {
4242
PasswordInput: 'password-input',
4343
TextArea: 'textarea',
4444
TextInput: 'textinput',
45+
Toast: 'toast',
46+
ToastContainer: 'toast-container',
4547
ProgressBar: 'progress-bar',
4648
Radio: 'radio',
4749
RadioGroup: 'radio-group',

packages/blade/src/utils/storybook/ComponentStatusTable.tsx

+27-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import type { ComponentStatuses } from './componentStatusData';
66
import { componentData } from './componentStatusData';
77
import type { IconComponent } from '~components/Icons';
88
import {
9+
CloseIcon,
910
StampIcon,
1011
EditIcon,
1112
CheckIcon,
@@ -169,19 +170,29 @@ const ComponentStatusTable = (): React.ReactElement => {
169170
<th align="left">
170171
<Text weight="semibold">Component</Text>
171172
</th>
172-
<th align="left">
173+
<th style={{ width: '30%' }} align="right">
173174
<Text weight="semibold">Status</Text>
174175
</th>
175176
<th style={{ width: '50%' }} align="left">
176177
<Text weight="semibold">Description</Text>
177178
</th>
179+
<th style={{ width: '10%' }} align="center">
180+
<Text weight="semibold">Web</Text>
181+
</th>
182+
<th style={{ width: '10%' }} align="center">
183+
<Text weight="semibold">RN</Text>
184+
</th>
178185
<th align="right">
179186
<Text weight="semibold">Released In</Text>
180187
</th>
181188
</tr>
182189
</thead>
183190
<tbody>
184191
{sortedData.map((data) => {
192+
const isAvailableOnWeb = data.platform === 'web';
193+
const isAvailableOnMobile = data.platform === 'mobile';
194+
const isAvailableOnAll = data.platform === 'all';
195+
185196
return (
186197
<tr key={data.name}>
187198
<td align="left">
@@ -191,14 +202,28 @@ const ComponentStatusTable = (): React.ReactElement => {
191202
<Text>{data.name}</Text>
192203
)}
193204
</td>
194-
<td align="left">
205+
<td align="right">
195206
<ComponentStatusBadge status={data.status} />
196207
</td>
197208
<td align="left">
198209
<Text size="medium" color="surface.text.gray.subtle">
199210
{data.description}
200211
</Text>
201212
</td>
213+
<td align="center">
214+
{isAvailableOnWeb || isAvailableOnAll ? (
215+
<CheckIcon color="feedback.icon.positive.intense" />
216+
) : (
217+
<CloseIcon color="feedback.icon.negative.intense" />
218+
)}
219+
</td>
220+
<td align="center">
221+
{isAvailableOnMobile || isAvailableOnAll ? (
222+
<CheckIcon color="feedback.icon.positive.intense" />
223+
) : (
224+
<CloseIcon color="feedback.icon.negative.intense" />
225+
)}
226+
</td>
202227
<td align="right">
203228
<ReleasedInLink version={data.releasedIn} />
204229
</td>

0 commit comments

Comments
 (0)