Skip to content

Commit 62811be

Browse files
refactor: [M3-9265] - Migrate Drawer to ui package (#11789)
## Description 📝 - Migrate `Drawer` from `manager` to `ui` 📁 - Adds a prop to `Drawer` that allows consumers to pass a `NotFound` component - Added a Story for `Drawer` with `NotFound` component as a Prop - Added a Story for `Drawer` without `NotFound` component as a Prop ## Preview - WithNotFoundComponent ![Screenshot 2025-03-14 at 5 32 29 PM](https://github.com/user-attachments/assets/54785e82-d86b-43bb-8a24-7e78a5311f2d) --- - WithoutNotFoundComponent ![Screenshot 2025-03-14 at 5 32 36 PM](https://github.com/user-attachments/assets/0ba6de97-e5bb-40c7-9eeb-7c5a50945afc) ## How to test 🧪 ### Verification steps - Check for regressions in Cloud Manager 👀 - Test the component in Storybook 📖 - All tests should pass ✅ <details> <summary> Author Checklists </summary> ## As an Author, to speed up the review process, I considered 🤔 👀 Doing a self review ❔ Our [contribution guidelines](https://github.com/linode/manager/blob/develop/docs/CONTRIBUTING.md) 🤏 Splitting feature into small PRs ➕ Adding a [changeset](https://github.com/linode/manager/blob/develop/docs/CONTRIBUTING.md#writing-a-changeset) 🧪 Providing/improving test coverage 🔐 Removing all sensitive information from the code and PR description 🚩 Using a feature flag to protect the release 👣 Providing comprehensive reproduction steps 📑 Providing or updating our documentation 🕛 Scheduling a pair reviewing session 📱 Providing mobile support ♿ Providing accessibility support <br/> - [x] I have read and considered all applicable items listed above. ## As an Author, before moving this PR from Draft to Open, I confirmed ✅ - [x] All unit tests are passing - [x] TypeScript compilation succeeded without errors - [x] Code passes all linting rules </details>
1 parent bb95401 commit 62811be

File tree

99 files changed

+775
-367
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+775
-367
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@linode/manager": Removed
3+
---
4+
5+
Migrate Drawer to ui package ([#11789](https://github.com/linode/manager/pull/11789))

packages/manager/cypress/e2e/core/objectStorage/enable-object-storage.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/**
22
* @file Cypress integration tests for OBJ enrollment and cancellation.
33
*/
4-
54
import {
65
accountFactory,
76
accountSettingsFactory,

packages/manager/src/components/TagCell/TagDrawer.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import { Drawer } from '@linode/ui';
12
import * as React from 'react';
23

3-
import { Drawer } from 'src/components/Drawer';
4-
4+
import { NotFound } from '../NotFound';
55
import { TagCell } from './TagCell';
66

77
export interface TagDrawerProps {
@@ -18,6 +18,7 @@ export const TagDrawer = (props: TagDrawerProps) => {
1818

1919
return (
2020
<Drawer
21+
NotFoundComponent={NotFound}
2122
onClose={onClose}
2223
open={open}
2324
title={'Tags' + (entityLabel ? ` (${entityLabel})` : '')}

packages/manager/src/features/Account/SwitchAccountDrawer.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { Notice, StyledLinkButton, Typography } from '@linode/ui';
1+
import { Drawer, Notice, StyledLinkButton, Typography } from '@linode/ui';
22
import React from 'react';
33

44
import { DebouncedSearchTextField } from 'src/components/DebouncedSearchTextField';
5-
import { Drawer } from 'src/components/Drawer';
5+
import { NotFound } from 'src/components/NotFound';
66
import { PARENT_USER_SESSION_EXPIRED } from 'src/features/Account/constants';
77
import { useParentChildAuthentication } from 'src/features/Account/SwitchAccounts/useParentChildAuthentication';
88
import { setTokenInLocalStorage } from 'src/features/Account/SwitchAccounts/utils';
@@ -123,7 +123,12 @@ export const SwitchAccountDrawer = (props: Props) => {
123123
}, [onClose, revokeToken, validateParentToken, updateCurrentToken]);
124124

125125
return (
126-
<Drawer onClose={onClose} open={open} title="Switch Account">
126+
<Drawer
127+
NotFoundComponent={NotFound}
128+
onClose={onClose}
129+
open={open}
130+
title="Switch Account"
131+
>
127132
{createTokenErrorReason && (
128133
<Notice text={createTokenErrorReason} variant="error" />
129134
)}

packages/manager/src/features/Backups/BackupDrawer.tsx

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,31 @@
1-
import { ActionsPanel, Box, Notice, Stack, Typography } from '@linode/ui';
1+
import {
2+
useAccountSettings,
3+
useAllLinodesQuery,
4+
useMutateAccountSettings,
5+
} from '@linode/queries';
6+
import {
7+
ActionsPanel,
8+
Box,
9+
Drawer,
10+
Notice,
11+
Stack,
12+
Typography,
13+
} from '@linode/ui';
214
import { isNumber, pluralize } from '@linode/utilities';
315
import { styled } from '@mui/material';
416
import { useSnackbar } from 'notistack';
517
import * as React from 'react';
618

719
import { DisplayPrice } from 'src/components/DisplayPrice';
8-
import { Drawer } from 'src/components/Drawer';
920
import { Link } from 'src/components/Link';
21+
import { NotFound } from 'src/components/NotFound';
1022
import { Table } from 'src/components/Table';
1123
import { TableBody } from 'src/components/TableBody';
1224
import { TableCell } from 'src/components/TableCell';
1325
import { TableHead } from 'src/components/TableHead';
1426
import { TableRow } from 'src/components/TableRow';
1527
import { TableRowError } from 'src/components/TableRowError/TableRowError';
1628
import { TableRowLoading } from 'src/components/TableRowLoading/TableRowLoading';
17-
import {
18-
useAccountSettings,
19-
useMutateAccountSettings,
20-
useAllLinodesQuery,
21-
} from '@linode/queries';
2229
import { useAllTypes } from 'src/queries/types';
2330
import { getTotalBackupsPrice } from 'src/utilities/pricing/backups';
2431
import { UNKNOWN_PRICE } from 'src/utilities/pricing/constants';
@@ -141,7 +148,13 @@ all new Linodes will automatically be backed up.`
141148
});
142149

143150
return (
144-
<Drawer onClose={onClose} open={open} title="Enable All Backups" wide>
151+
<Drawer
152+
NotFoundComponent={NotFound}
153+
onClose={onClose}
154+
open={open}
155+
title="Enable All Backups"
156+
wide
157+
>
145158
<Stack spacing={2}>
146159
<Typography variant="body1">
147160
Three backup slots are executed and rotated automatically: a daily

packages/manager/src/features/Billing/BillingPanels/BillingSummary/BillingSummary.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { useGrants, useNotificationsQuery } from '@linode/queries';
12
import { Box, Button, Divider, TooltipIcon, Typography } from '@linode/ui';
23
import Grid from '@mui/material/Grid2';
34
import { useTheme } from '@mui/material/styles';
@@ -6,7 +7,6 @@ import { useHistory, useLocation, useRouteMatch } from 'react-router-dom';
67

78
import { Currency } from 'src/components/Currency';
89
import { useAccountManagement } from 'src/hooks/useAccountManagement';
9-
import { useNotificationsQuery, useGrants } from '@linode/queries';
1010
import { isWithinDays } from 'src/utilities/date';
1111

1212
import { BillingPaper } from '../../BillingDetail';

packages/manager/src/features/Billing/BillingPanels/BillingSummary/PaymentDrawer/PaymentDrawer.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import userEvent from '@testing-library/user-event';
77
import * as React from 'react';
88

99
import { paymentFactory } from 'src/factories/billing';
10-
import { http, HttpResponse, server } from 'src/mocks/testServer';
10+
import { HttpResponse, http, server } from 'src/mocks/testServer';
1111
import { wrapWithTheme } from 'src/utilities/testHelpers';
1212

1313
import PaymentDrawer, { getMinimumPayment } from './PaymentDrawer';

packages/manager/src/features/Billing/BillingPanels/BillingSummary/PaymentDrawer/PaymentDrawer.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
import { makePayment } from '@linode/api-v4/lib/account';
2+
import { accountQueries, useAccount, useProfile } from '@linode/queries';
23
import {
3-
Typography,
44
Button,
55
Divider,
6+
Drawer,
67
ErrorState,
78
InputAdornment,
89
Notice,
910
Stack,
1011
TextField,
1112
TooltipIcon,
13+
Typography,
1214
} from '@linode/ui';
1315
import Grid from '@mui/material/Grid2';
1416
import { useQueryClient } from '@tanstack/react-query';
@@ -17,12 +19,11 @@ import * as React from 'react';
1719
import { makeStyles } from 'tss-react/mui';
1820

1921
import { Currency } from 'src/components/Currency';
20-
import { Drawer } from 'src/components/Drawer';
2122
import { LinearProgress } from 'src/components/LinearProgress';
23+
import { NotFound } from 'src/components/NotFound';
2224
import { SupportLink } from 'src/components/SupportLink';
2325
import { getRestrictedResourceText } from 'src/features/Account/utils';
2426
import { useRestrictedGlobalGrantCheck } from 'src/hooks/useRestrictedGlobalGrantCheck';
25-
import { useAccount, accountQueries, useProfile } from '@linode/queries';
2627
import { isCreditCardExpired } from 'src/utilities/creditCard';
2728
import { getAPIErrorOrDefault } from 'src/utilities/errorUtils';
2829

@@ -237,7 +238,12 @@ export const PaymentDrawer = (props: Props) => {
237238
}
238239

239240
return (
240-
<Drawer onClose={onClose} open={open} title="Make a Payment">
241+
<Drawer
242+
NotFoundComponent={NotFound}
243+
onClose={onClose}
244+
open={open}
245+
title="Make a Payment"
246+
>
241247
<Stack spacing={2}>
242248
{isReadOnly && (
243249
<Notice

packages/manager/src/features/Billing/BillingPanels/ContactInfoPanel/EditBillingContactDrawer.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
import { Drawer } from '@linode/ui';
12
import * as React from 'react';
23
import { makeStyles } from 'tss-react/mui';
34

4-
import { Drawer } from 'src/components/Drawer';
5+
import { NotFound } from 'src/components/NotFound';
56

67
import UpdateContactInformationForm from './UpdateContactInformationForm';
78

@@ -29,6 +30,7 @@ export const BillingContactDrawer = (props: Props) => {
2930

3031
return (
3132
<Drawer
33+
NotFoundComponent={NotFound}
3234
className={classes.drawer}
3335
onClose={onClose}
3436
open={open}

packages/manager/src/features/Billing/BillingPanels/PaymentInfoPanel/AddPaymentMethodDrawer/AddPaymentMethodDrawer.tsx

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
1-
import { Box, Divider, Notice, TooltipIcon, Typography } from '@linode/ui';
1+
import { useProfile } from '@linode/queries';
2+
import {
3+
Box,
4+
Divider,
5+
Drawer,
6+
Notice,
7+
TooltipIcon,
8+
Typography,
9+
} from '@linode/ui';
210
import Grid from '@mui/material/Grid2';
311
import * as React from 'react';
412

5-
import { Drawer } from 'src/components/Drawer';
613
import { LinearProgress } from 'src/components/LinearProgress';
14+
import { NotFound } from 'src/components/NotFound';
715
import { MAXIMUM_PAYMENT_METHODS } from 'src/constants';
816
import { getRestrictedResourceText } from 'src/features/Account/utils';
917
import { useRestrictedGlobalGrantCheck } from 'src/hooks/useRestrictedGlobalGrantCheck';
10-
import { useProfile } from '@linode/queries';
1118

1219
import GooglePayChip from '../GooglePayChip';
1320
import { PayPalChip } from '../PayPalChip';
@@ -86,7 +93,12 @@ export const AddPaymentMethodDrawer = (props: Props) => {
8693
const disabled = isProcessing || hasMaxPaymentMethods || isReadOnly;
8794

8895
return (
89-
<Drawer onClose={onClose} open={open} title="Add Payment Method">
96+
<Drawer
97+
NotFoundComponent={NotFound}
98+
onClose={onClose}
99+
open={open}
100+
title="Add Payment Method"
101+
>
90102
{isProcessing ? (
91103
<LinearProgress
92104
sx={{
@@ -136,7 +148,6 @@ export const AddPaymentMethodDrawer = (props: Props) => {
136148
</Grid>
137149
{!isReadOnly && (
138150
<Grid
139-
container
140151
size={{
141152
md: 3,
142153
xs: 4,
@@ -145,6 +156,7 @@ export const AddPaymentMethodDrawer = (props: Props) => {
145156
alignContent: 'center',
146157
justifyContent: 'flex-end',
147158
}}
159+
container
148160
>
149161
<GooglePayChip
150162
disabled={disabled}
@@ -173,7 +185,6 @@ export const AddPaymentMethodDrawer = (props: Props) => {
173185
</Grid>
174186
{!isReadOnly && (
175187
<Grid
176-
container
177188
size={{
178189
md: 3,
179190
xs: 4,
@@ -182,6 +193,7 @@ export const AddPaymentMethodDrawer = (props: Props) => {
182193
alignContent: 'center',
183194
justifyContent: 'flex-end',
184195
}}
196+
container
185197
>
186198
<PayPalErrorBoundary renderError={renderError}>
187199
<PayPalChip

0 commit comments

Comments
 (0)