Skip to content
This repository was archived by the owner on Sep 22, 2023. It is now read-only.

Commit 41738a3

Browse files
author
mprcodes
committed
refactor Callout component and its styles
1 parent b9813a4 commit 41738a3

File tree

2 files changed

+56
-37
lines changed

2 files changed

+56
-37
lines changed

components/Callout.jsx

+10-13
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
import CalloutStyles from '../styles/Callout.module.css'
1+
import styles from '../styles/Callout.module.css'
22

3-
const Callout = ({ type, children }) => {
4-
const calloutType = `callout--${type}`
5-
let title
3+
export default function Callout({ type, children }) {
4+
const calloutType = `container--${type}`
5+
let title = 'Nota'
66

77
switch (type) {
8+
case 'beta':
9+
title = 'Software Beta'
10+
break
811
case 'experiment':
912
title = 'Experimenta'
1013
break
@@ -16,15 +19,9 @@ const Callout = ({ type, children }) => {
1619
}
1720

1821
return (
19-
<div
20-
className={`${CalloutStyles.callout} ${
21-
type !== 'note' ? CalloutStyles[calloutType] : ''
22-
}`}
23-
>
24-
<p className={CalloutStyles.callout__title}>{title}</p>
22+
<aside className={`${styles.container} ${styles[calloutType]}`}>
23+
<p className={styles.title}>{title}</p>
2524
{children}
26-
</div>
25+
</aside>
2726
)
2827
}
29-
30-
export default Callout

styles/Callout.module.css

+46-24
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,63 @@
1-
.callout {
1+
html[class~='dark'] .container {
2+
background-color: hsl(0deg 0% 16%);
3+
color: hsl(0deg 0% 80%);
4+
}
5+
6+
html[class~='light'] .container {
7+
background-color: hsl(0deg 0% 88%);
8+
color: hsl(0deg 0% 24%);
9+
}
10+
11+
html[class~='dark'] .container--important {
12+
background-color: hsl(8deg 8.79% 15.05%);
13+
border-color: hsl(8.43deg 66.05% 51.01%);
14+
}
15+
16+
html[class~='light'] .container--important {
17+
background-color: hsl(8deg 100% 97%);
18+
border-color: hsl(8.43deg 84.96% 51.98%);
19+
}
20+
21+
html[class~='dark'] .container--experiment {
22+
background-color: hsl(212.78deg 15.68% 13.72%);
23+
border-color: hsl(212.14deg 66.05% 51.01%);
24+
}
25+
26+
html[class~='light'] .container--experiment {
27+
background-color: hsl(213.7deg 100% 97.22%);
28+
border-color: hsl(212.86deg 82.85% 54.36%);
29+
}
30+
31+
.container {
232
margin: 32px 0 40px 0;
3-
border-left: solid 5px #ccc;
4-
background-color: #f5f5f5;
5-
color: #242424;
6-
padding: 20px 20px 20px 20px;
7-
font-size: 10px;
8-
border-radius: 2px;
33+
border-left: solid 6px hsl(0deg 0% 69.02%);
34+
padding: 20px;
35+
border-radius: 4px;
936
}
1037

1138
@media screen and (min-width: 768px) {
12-
.callout {
39+
.container {
1340
margin: 40px 0 40px 2px;
14-
padding: 20px;
1541
}
1642
}
1743

18-
.callout--experiment {
19-
border-color: #0088cc;
44+
.container--beta,
45+
.container--note {
46+
border-color: hsl(0deg 0% 69.02%);
2047
}
2148

22-
.callout--important {
23-
border-color: #f05137;
24-
}
25-
26-
.callout :not(:first-child),
27-
.callout code {
49+
.container :not(:first-child),
50+
.container code {
2851
margin: 0;
29-
font-size: 0.96rem;
3052
line-height: 176%;
3153
}
3254

33-
.callout__title {
34-
text-transform: uppercase;
35-
font-weight: normal;
36-
color: #707070;
37-
font-size: 0.7rem;
38-
letter-spacing: 2px;
55+
.container a {
56+
font-size: inherit !important;
57+
}
58+
59+
.title {
60+
font-weight: 700;
3961
margin-bottom: 0.8rem;
4062
width: 'fit-content';
4163
}

0 commit comments

Comments
 (0)