Skip to content

Commit

Permalink
Adapt Alert styling (#2891)
Browse files Browse the repository at this point in the history
Co-authored-by: Julia Wegmayr <julia.wegmayr@vivid-planet.com>
Co-authored-by: Ricky Smith <jamesricky@me.com>
  • Loading branch information
3 people authored Dec 18, 2024
1 parent 4361ec6 commit b374300
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 12 deletions.
21 changes: 21 additions & 0 deletions .changeset/fifty-buses-hope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
"@comet/admin": major
---

Adapt the styling of `Alert` to match the updated Comet design

Remove styling for the `text` variant of buttons used in `Alert`.
Use buttons with the `outlined` variant instead to adhere to the Comet design guidelines.

```diff
<Alert
// ...
action={
- <Button variant="text" startIcon={<ArrowRight />}>
+ <Button variant="outlined" startIcon={<ArrowRight />}>
Action Text
</Button>
}
// ...
>
```
15 changes: 8 additions & 7 deletions packages/admin/admin/src/alert/Alert.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Close } from "@comet/admin-icons";
// eslint-disable-next-line no-restricted-imports
import { Alert as MuiAlert, alertClasses, AlertTitle, buttonClasses, IconButton, Typography } from "@mui/material";
import { Alert as MuiAlert, alertClasses, AlertTitle, IconButton, Typography } from "@mui/material";
import { css, useThemeProps } from "@mui/material/styles";
import { forwardRef, ReactNode } from "react";

Expand Down Expand Up @@ -86,11 +86,7 @@ const Root = createComponentSlot(MuiAlert)<AlertClassKey, OwnerState>({
css`
position: relative;
align-items: flex-start;
padding: ${theme.spacing(4, 6, "8px", 3)};
& .${buttonClasses.text} {
margin-left: -15px;
}
padding: ${theme.spacing(4, 6, 4, 4)};
& .${alertClasses.message} {
flex-direction: column;
Expand All @@ -102,7 +98,7 @@ const Root = createComponentSlot(MuiAlert)<AlertClassKey, OwnerState>({
css`
display: flex;
align-items: center;
padding: ${theme.spacing(2, "12px", 2, 4)};
padding: ${theme.spacing(2, 4, 2, 4)};
`}
`,
);
Expand Down Expand Up @@ -144,6 +140,11 @@ const CloseIcon = createComponentSlot(IconButton)<AlertClassKey, OwnerState>({
right: 2px;
top: 2px;
`}
${ownerState.renderAsSingleRow &&
css`
padding: 10px;
`}
`,
);

Expand Down
10 changes: 5 additions & 5 deletions storybook/src/admin/alert/Alert.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const Alerts = () => {
severity="info"
title="Title"
action={
<Button variant="text" startIcon={<ArrowRight />}>
<Button variant="outlined" startIcon={<ArrowRight />}>
Action Text
</Button>
}
Expand All @@ -34,7 +34,7 @@ export const Alerts = () => {
severity="warning"
title="Title"
action={
<Button variant="text" startIcon={<ArrowRight />}>
<Button variant="outlined" startIcon={<ArrowRight />}>
Action Text
</Button>
}
Expand All @@ -50,7 +50,7 @@ export const Alerts = () => {
severity="error"
title="Title"
action={
<Button variant="text" startIcon={<ArrowRight />}>
<Button variant="outlined" startIcon={<ArrowRight />}>
Action Text
</Button>
}
Expand Down Expand Up @@ -105,7 +105,7 @@ export const Alerts = () => {
<Alert
severity="success"
action={
<Button variant="text" startIcon={<ArrowRight />}>
<Button variant="outlined" startIcon={<ArrowRight />}>
Action Text
</Button>
}
Expand All @@ -132,7 +132,7 @@ export const Alerts = () => {
<Alert
severity="warning"
action={
<Button variant="text" startIcon={<ArrowRight />}>
<Button variant="outlined" startIcon={<ArrowRight />}>
Action Text
</Button>
}
Expand Down

0 comments on commit b374300

Please sign in to comment.