Skip to content

Commit 4139832

Browse files
committed
update style
1 parent 9b426c4 commit 4139832

File tree

3 files changed

+39
-29
lines changed

3 files changed

+39
-29
lines changed

app/globals.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@
6363
--flame7: #edcf9e;
6464
--flame8: #ffefae;
6565

66+
/* Desaturated oranges */
67+
--desatFlame8: #fefbe9;
68+
6669
/* A range of desaturated purples */
6770
--desatPurple0: #0f0a1f;
6871
--desatPurple1: #231c3d;

src/components/alert/index.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {ReactNode} from 'react';
2+
import {ExclamationTriangleIcon, InfoCircledIcon} from '@radix-ui/react-icons';
23

34
// explicitly not usig CSS modules here
45
// because there's some prerendered content that depends on these exact class names
@@ -11,10 +12,15 @@ type AlertProps = {
1112
};
1213

1314
export function Alert({title, children, level = 'info'}: AlertProps) {
15+
const Icon = level === 'warning' ? ExclamationTriangleIcon : InfoCircledIcon;
16+
1417
return (
1518
<div className={`alert ${'alert-' + level}`} role="alert">
16-
{title && <h5 className="alert-header">{title}</h5>}
17-
<div className="alert-body content-flush-bottom">{children}</div>
19+
<Icon className='alert-icon' />
20+
<div className="alert-content">
21+
{title && <h5 className="alert-header">{title}</h5>}
22+
<div className="alert-body content-flush-bottom">{children}</div>
23+
</div>
1824
</div>
1925
);
2026
}

src/components/alert/styles.scss

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,54 @@
11
.alert {
22
background: var(--accent-2);
3-
border-color: var(--accent-12);
4-
border-left: 3px solid var(--accent-12);
53
margin-bottom: 1rem;
64
padding: 0.5rem 1rem;
7-
8-
> .alert-header {
9-
font-weight: 500;
10-
position: relative;
11-
font-size: 1em;
12-
margin-bottom: 0.5rem;
13-
margin-top: 0.25rem;
14-
}
5+
border-radius: 6px;
6+
color: var(--gray-500);
7+
display: flex;
8+
flex-direction: row;
9+
gap: 0.7em;
10+
line-height: 1.75em;
1511

1612
p {
1713
margin-bottom: 0.5rem;
14+
margin-top: 0;
1815
}
1916

2017
strong {
2118
font-weight: 500;
2219
}
2320

24-
ul {
21+
ul, ol {
2522
padding-inline-start: 2rem;
23+
margin-top: 0;
2624
}
2725

28-
p:last-of-type,
29-
ul:last-of-type {
30-
margin-bottom: 0;
26+
li {
27+
padding-inline-start: 0;
28+
margin: 0;
3129
}
30+
}
3231

33-
p:first-of-type,
34-
ul:first-of-type {
35-
margin-top: 0;
36-
}
32+
.alert-icon {
33+
flex: 1em 0 0;
34+
height: 1.75em;
35+
}
3736

38-
.alert-body {
39-
font-size: 0.9rem;
40-
}
37+
.alert-content {
38+
}
39+
40+
.alert-header {
41+
font-weight: 500;
4142
}
4243

4344
.alert-info {
44-
background: var(--blue-2);
45-
border-color: var(--blue-11);
46-
color: var(--blue-12);
45+
background: var(--desatPurple15);
4746
}
4847

4948
.alert-warning {
50-
background: var(--amber-2);
51-
border-color: var(--amber-10);
52-
color: var(--amber-12);
49+
background: var(--desatFlame8);
50+
51+
> .alert-icon {
52+
color: var(--flame5);
53+
}
5354
}

0 commit comments

Comments
 (0)