Skip to content

Commit c6361bf

Browse files
authored
fix: [M3-9796] - Notice icon, padding, and dark mode (#12065)
## Changes 🔄 - Fix icon not changing in dark mode - Fix left padding - All notices/banners have icons associated now without the need for important - Removed important references from the codebase and stories No need for changeset since this isn't released yet. I did a quick pass-through and haven't noticed any regressions ## How to test 🧪 ### Verification steps (How to verify changes) - [ ] Check notices/banners for regressions across the codebase in dark mode, various sizes, and storybook
1 parent 6b5f8a8 commit c6361bf

File tree

63 files changed

+172
-323
lines changed

Some content is hidden

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

63 files changed

+172
-323
lines changed

packages/manager/cypress/e2e/core/objectStorageGen2/bucket-object-gen2.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ describe('Object Storage Gen2 bucket object tests', () => {
413413
cy.findByText(mockRegions[0].label).should('be.visible');
414414
});
415415
// warning message
416-
cy.findByTestId('notice-warning-important').within(() => {
416+
cy.findByTestId('notice-warning').within(() => {
417417
cy.contains(
418418
`There was an error loading buckets in ${mockRegions[1].label}`
419419
);
@@ -463,7 +463,7 @@ describe('Object Storage Gen2 bucket object tests', () => {
463463
// table with retrieved bucket
464464
cy.get('table tbody tr').should('have.length', 1);
465465
// warning message
466-
cy.findByTestId('notice-warning-important').within(() => {
466+
cy.findByTestId('notice-warning').within(() => {
467467
cy.contains(
468468
'There was an error loading buckets in the following regions:'
469469
);

packages/manager/src/components/AbuseTicketBanner/AbuseTicketBanner.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export const AbuseTicketBanner = () => {
3333

3434
const href = multiple
3535
? '/support/tickets'
36-
: abuseTickets[0].entity?.url ?? '';
36+
: (abuseTickets[0].entity?.url ?? '');
3737
const isViewingTicket = location.pathname.match(href);
3838

3939
return (
@@ -43,7 +43,6 @@ export const AbuseTicketBanner = () => {
4343
expiry: DateTime.utc().plus({ days: 7 }).toISO(),
4444
label: preferenceKey,
4545
}}
46-
important
4746
preferenceKey={preferenceKey}
4847
variant="warning"
4948
>

packages/manager/src/components/DismissibleBanner/DismissibleBanner.stories.tsx

+2-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ type Story = StoryObj<typeof DismissibleBanner>;
1111

1212
export const Default: Story = {
1313
render: (args) => (
14-
<DismissibleBanner {...args} important variant="info">
14+
<DismissibleBanner {...args} variant="info">
1515
<Typography>This is an example of a dismissible banner.</Typography>
1616
</DismissibleBanner>
1717
),
@@ -29,7 +29,6 @@ export const CallToActionBanner: Story = {
2929
</Button>
3030
}
3131
forceImportantIconVerticalCenter
32-
important
3332
preferenceKey="cluster-v1"
3433
variant="info"
3534
>
@@ -60,12 +59,11 @@ export const BetaBanner: Story = {
6059
export const InfoWithLongTextAndMarkup: StoryObj = {
6160
render: () => (
6261
<DismissibleBanner
63-
important
6462
preferenceKey="lenghty-dismissible-banner"
6563
variant="info"
6664
>
6765
<Typography variant="h2">
68-
This is an important, dismissible informational notice with a title.
66+
This is a dismissible informational notice with a title.
6967
</Typography>
7068
<Typography>This notice contains long text that should wrap.</Typography>
7169
</DismissibleBanner>

packages/manager/src/components/DismissibleBanner/DismissibleBanner.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ export const DismissibleBanner = (props: Props) => {
6363
'& svg': {
6464
width: 16,
6565
height: 16,
66+
'& path': {
67+
fill: theme.tokens.component.NotificationBanner.Icon,
68+
},
6669
},
6770
})}
6871
>

packages/manager/src/components/MaintenanceBanner/MaintenanceBanner.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export const MaintenanceBanner = React.memo((props: Props) => {
6868
}
6969

7070
return (
71-
<Notice important variant="warning">
71+
<Notice variant="warning">
7272
<Typography lineHeight="20px">
7373
{generateIntroText(type, maintenanceStart, maintenanceEnd)}
7474
</Typography>

packages/manager/src/components/ProductInformationBanner/ProductInformationBanner.tsx

-8
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,6 @@ export const ProductInformationBanner = React.memo(
2929
return null;
3030
}
3131

32-
const isImportantBanner =
33-
thisBanner.decoration.important === 'true'
34-
? true
35-
: thisBanner.decoration.important === 'false'
36-
? false
37-
: true;
38-
3932
let hasBannerExpired = true;
4033
try {
4134
hasBannerExpired = isAfter(
@@ -52,7 +45,6 @@ export const ProductInformationBanner = React.memo(
5245

5346
return (
5447
<DismissibleBanner
55-
important={isImportantBanner}
5648
preferenceKey={`${bannerLocation}-${thisBanner.expirationDate}`}
5749
variant={thisBanner.decoration.variant ?? 'warning'}
5850
{...rest}

packages/manager/src/components/ProductNotification/ProductNotification.tsx

+1-5
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,5 @@ export const ProductNotification = ({
2222
const level = (severityLevelMap[severity] as NoticeVariant) ?? 'warning';
2323
const props = { variant: level };
2424

25-
return (
26-
<Notice {...props} important>
27-
{text}
28-
</Notice>
29-
);
25+
return <Notice {...props}>{text}</Notice>;
3026
};

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

-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ const AccountLogins = () => {
165165
isChildUser,
166166
resourceType: 'Account',
167167
})}
168-
important
169168
variant="warning"
170169
/>
171170
);

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

+3-5
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ interface Props {
1919
}
2020

2121
const CloseAccountDialog = ({ closeDialog, open }: Props) => {
22-
const [isClosingAccount, setIsClosingAccount] = React.useState<boolean>(
23-
false
24-
);
22+
const [isClosingAccount, setIsClosingAccount] =
23+
React.useState<boolean>(false);
2524
const [errors, setErrors] = React.useState<APIError[] | undefined>(undefined);
2625
const [comments, setComments] = React.useState<string>('');
2726
const history = useHistory();
@@ -103,11 +102,10 @@ const CloseAccountDialog = ({ closeDialog, open }: Props) => {
103102
) : null}
104103
<StyledNoticeWrapper>
105104
<Notice
105+
spacingBottom={12}
106106
sx={(theme) => ({
107107
border: `1px solid ${theme.tokens.alias.Action.Negative.Default}`,
108108
})}
109-
important
110-
spacingBottom={12}
111109
variant="error"
112110
>
113111
<Typography sx={{ fontSize: '0.875rem' }}>

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

+6-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,12 @@ export const BackupsCTA = () => {
6666
<IconButton
6767
aria-label="Dismiss notice enabling Linode backups"
6868
onClick={handleDismiss}
69-
sx={{ padding: 0.25 }}
69+
sx={(theme) => ({
70+
padding: 0.25,
71+
'& path': {
72+
fill: theme.tokens.component.NotificationBanner.Icon,
73+
},
74+
})}
7075
>
7176
<CloseIcon />
7277
</IconButton>

packages/manager/src/features/Databases/DatabaseCreate/DatabaseCreate.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -250,12 +250,11 @@ const DatabaseCreate = () => {
250250
/>
251251
{isRestricted && (
252252
<Notice
253+
spacingTop={16}
253254
text={getRestrictedResourceText({
254255
action: 'create',
255256
resourceType: 'Databases',
256257
})}
257-
important
258-
spacingTop={16}
259258
variant="error"
260259
/>
261260
)}

packages/manager/src/features/Databases/DatabaseDetail/DatabaseAdvancedConfiguration/DatabaseAdvancedConfigurationDrawer.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ export const DatabaseAdvancedConfigurationDrawer = (props: Props) => {
183183
</Typography>
184184
<Link to={ADVANCED_CONFIG_LEARN_MORE_LINK}>Learn more.</Link>
185185

186-
<Notice important sx={{ mb: 1, mt: 3 }} variant="info">
186+
<Notice sx={{ mb: 1, mt: 3 }} variant="info">
187187
<Typography>{ADVANCED_CONFIG_INFO}</Typography>
188188
</Notice>
189189

packages/manager/src/features/Databases/DatabaseDetail/index.tsx

+2-6
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,8 @@ export const DatabaseDetail = () => {
6565
id,
6666
});
6767

68-
const {
69-
editableLabelError,
70-
resetEditableLabel,
71-
setEditableLabelError,
72-
} = useEditableLabelState();
68+
const { editableLabelError, resetEditableLabel, setEditableLabelError } =
69+
useEditableLabelState();
7370

7471
if (error) {
7572
return (
@@ -207,7 +204,6 @@ export const DatabaseDetail = () => {
207204
text={
208205
"You don't have permissions to modify this Database. Please contact an account administrator for details."
209206
}
210-
important
211207
variant="warning"
212208
/>
213209
)}

packages/manager/src/features/Domains/CreateDomain/CreateDomain.tsx

+4-9
Original file line numberDiff line numberDiff line change
@@ -81,18 +81,14 @@ export const CreateDomain = () => {
8181
},
8282
];
8383

84-
const [
85-
defaultRecordsSetting,
86-
setDefaultRecordsSetting,
87-
] = React.useState<DefaultRecordsSetting>(defaultRecords[0]);
84+
const [defaultRecordsSetting, setDefaultRecordsSetting] =
85+
React.useState<DefaultRecordsSetting>(defaultRecords[0]);
8886

8987
const [selectedDefaultLinode, setSelectedDefaultLinode] = React.useState<
9088
Linode | undefined
9189
>(undefined);
92-
const [
93-
selectedDefaultNodeBalancer,
94-
setSelectedDefaultNodeBalancer,
95-
] = React.useState<NodeBalancer | undefined>(undefined);
90+
const [selectedDefaultNodeBalancer, setSelectedDefaultNodeBalancer] =
91+
React.useState<NodeBalancer | undefined>(undefined);
9692

9793
const { values, ...formik } = useFormik({
9894
initialValues: {
@@ -303,7 +299,6 @@ export const CreateDomain = () => {
303299
text={
304300
"You don't have permissions to create a new Domain. Please contact an account administrator for details."
305301
}
306-
important
307302
variant="error"
308303
/>
309304
)}

packages/manager/src/features/Domains/DomainBanner.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ export const DomainBanner = React.memo((props: DomainBannerProps) => {
2525
expiry: DateTime.utc().plus({ days: 30 }).toISO(),
2626
label: KEY,
2727
}}
28-
important
2928
preferenceKey={KEY}
3029
variant="warning"
3130
>

packages/manager/src/features/Firewalls/FirewallDetail/Devices/FirewallDeviceLanding.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ export const FirewallDeviceLanding = React.memo(
8282
text={
8383
"You don't have permissions to modify this Firewall. Please contact an account administrator for details."
8484
}
85-
important
8685
variant="error"
8786
/>
8887
) : null}

packages/manager/src/features/Firewalls/FirewallDetail/Rules/FirewallRulesLanding.tsx

+19-22
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,8 @@ interface Drawer {
5353

5454
export const FirewallRulesLanding = React.memo((props: Props) => {
5555
const { disabled, firewallID, rules } = props;
56-
const { mutateAsync: updateFirewallRules } = useUpdateFirewallRulesMutation(
57-
firewallID
58-
);
56+
const { mutateAsync: updateFirewallRules } =
57+
useUpdateFirewallRulesMutation(firewallID);
5958
const { data: devices } = useAllFirewallDevicesQuery(firewallID);
6059
const queryClient = useQueryClient();
6160
const navigate = useNavigate();
@@ -95,10 +94,8 @@ export const FirewallRulesLanding = React.memo((props: Props) => {
9594
const [generalErrors, setGeneralErrors] = React.useState<
9695
APIError[] | undefined
9796
>();
98-
const [
99-
discardChangesModalOpen,
100-
setDiscardChangesModalOpen,
101-
] = React.useState<boolean>(false);
97+
const [discardChangesModalOpen, setDiscardChangesModalOpen] =
98+
React.useState<boolean>(false);
10299

103100
const openRuleDrawer = (
104101
category: Category,
@@ -116,10 +113,10 @@ export const FirewallRulesLanding = React.memo((props: Props) => {
116113
category === 'inbound' && mode === 'create'
117114
? '/firewalls/$id/rules/add/inbound'
118115
: category === 'inbound' && mode === 'edit'
119-
? `/firewalls/$id/rules/edit/inbound/$ruleId`
120-
: category === 'outbound' && mode === 'create'
121-
? '/firewalls/$id/rules/add/outbound'
122-
: `/firewalls/$id/rules/edit/outbound/$ruleId`,
116+
? `/firewalls/$id/rules/edit/inbound/$ruleId`
117+
: category === 'outbound' && mode === 'create'
118+
? '/firewalls/$id/rules/add/outbound'
119+
: `/firewalls/$id/rules/edit/outbound/$ruleId`,
123120
});
124121
};
125122

@@ -319,12 +316,14 @@ export const FirewallRulesLanding = React.memo((props: Props) => {
319316
}
320317
}, [status, reset]);
321318

322-
const inboundRules = React.useMemo(() => editorStateToRules(inboundState), [
323-
inboundState,
324-
]);
325-
const outboundRules = React.useMemo(() => editorStateToRules(outboundState), [
326-
outboundState,
327-
]);
319+
const inboundRules = React.useMemo(
320+
() => editorStateToRules(inboundState),
321+
[inboundState]
322+
);
323+
const outboundRules = React.useMemo(
324+
() => editorStateToRules(outboundState),
325+
[outboundState]
326+
);
328327

329328
// This is for the Rule Drawer. If there is a rule to modify,
330329
// we need to pass it to the drawer to pre-populate the form fields.
@@ -385,7 +384,6 @@ export const FirewallRulesLanding = React.memo((props: Props) => {
385384
text={
386385
"You don't have permissions to modify this Firewall. Please contact an account administrator for details."
387386
}
388-
important
389387
variant="error"
390388
/>
391389
) : null}
@@ -495,8 +493,8 @@ interface DiscardChangesDialogProps {
495493
isOpen: boolean;
496494
}
497495

498-
export const DiscardChangesDialog: React.FC<DiscardChangesDialogProps> = React.memo(
499-
(props) => {
496+
export const DiscardChangesDialog: React.FC<DiscardChangesDialogProps> =
497+
React.memo((props) => {
500498
const { handleClose, handleDiscard, isOpen } = props;
501499

502500
const actions = React.useCallback(
@@ -527,5 +525,4 @@ export const DiscardChangesDialog: React.FC<DiscardChangesDialogProps> = React.m
527525
</Typography>
528526
</ConfirmationDialog>
529527
);
530-
}
531-
);
528+
});

packages/manager/src/features/GlobalNotifications/APIMaintenanceBanner.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ export const APIMaintenanceBanner = React.memo((props: Props) => {
6464

6565
return (
6666
<DismissibleBanner
67-
important
6867
key={scheduledAPIMaintenance.id}
6968
preferenceKey={scheduledAPIMaintenance.id}
7069
variant="warning"

packages/manager/src/features/GlobalNotifications/ComplianceBanner.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ export const ComplianceBanner = () => {
2727
Review Update
2828
</StyledActionButton>
2929
}
30-
important
3130
preferenceKey="gdpr-compliance"
3231
variant="warning"
3332
>

packages/manager/src/features/GlobalNotifications/CreditCardExpiredBanner.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ export const CreditCardExpiredBanner = () => {
3535
</Button>
3636
}
3737
forceImportantIconVerticalCenter
38-
important
3938
preferenceKey={'credit-card-expired'}
4039
variant="error"
4140
>

packages/manager/src/features/GlobalNotifications/DatabaseMigrationInfoBanner.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import { SupportLink } from 'src/components/SupportLink';
55

66
export const DatabaseMigrationInfoBanner = () => {
77
return (
8-
<Notice important top={10} variant="warning">
8+
<Notice top={10} variant="warning">
99
<Typography
10+
lineHeight="20px"
1011
sx={(theme) => ({
1112
font: theme.font.bold,
1213
})}
13-
lineHeight="20px"
1414
>
1515
Legacy clusters decommission
1616
</Typography>

packages/manager/src/features/GlobalNotifications/EmailBounce.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ const EmailBounceNotification = React.memo((props: Props) => {
131131
}
132132

133133
return (
134-
<Notice forceImportantIconVerticalCenter important variant="warning">
134+
<Notice forceImportantIconVerticalCenter variant="warning">
135135
<Grid
136136
container
137137
display="flex"

0 commit comments

Comments
 (0)