Skip to content

Commit 35cbeba

Browse files
committed
remove unused GuideCard color variants and fix its background color for dark mode
1 parent eaa6728 commit 35cbeba

File tree

3 files changed

+13
-45
lines changed

3 files changed

+13
-45
lines changed

src/components/GuideCard.js

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,16 @@
11
import React, { memo } from 'react';
22
import { Link } from 'gatsby';
3-
import cn from 'classnames';
43

54
import ButtonPanel from './ButtonPanel';
65
import Image from './Image';
76

87
import * as css from './GuideCard.module.css';
98

10-
const GuideCard = ({
11-
title,
12-
slug,
13-
meta,
14-
icon = '📒',
15-
description,
16-
image,
17-
variant
18-
}) => {
9+
const GuideCard = ({ title, slug, meta, icon = '📒', description, image }) => {
10+
// TODO refactor this to use a single ButtonPanel instance?
11+
1912
return (
20-
<article className={cn(css.root, css[variant])}>
13+
<article className={css.root}>
2114
<div className={css.top}>
2215
<div className={css.icon}>{icon}</div>
2316
<h2 className={css.title}>
@@ -32,7 +25,7 @@ const GuideCard = ({
3225
text={meta}
3326
buttonLink={slug}
3427
buttonText="Read"
35-
variant={variant}
28+
variant="purple"
3629
rainbow
3730
/>
3831
</div>
@@ -45,7 +38,7 @@ const GuideCard = ({
4538
text={meta}
4639
buttonLink={slug}
4740
buttonText="Read"
48-
variant={variant}
41+
variant="purple"
4942
rainbow
5043
/>
5144
</div>

src/components/GuideCard.module.css

Lines changed: 7 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,46 +5,18 @@
55
display: flex;
66
flex-direction: column;
77

8-
--color: var(--gray-dark);
8+
--color: var(--purple);
9+
--border: var(--border-purple);
910

1011
@media (--medium) {
1112
width: 100%;
1213
flex-basis: 100%;
1314
}
1415
}
1516

16-
/* variants */
17-
.root.purple {
18-
--color: var(--purple);
19-
--border: var(--border-purple);
20-
--background-color: var(--purple-light);
21-
}
22-
23-
.root.red {
24-
--color: var(--red);
25-
--border: var(--border-red);
26-
--background-color: var(--red-light);
27-
}
28-
29-
.root.orange {
30-
--color: var(--orange);
31-
--border: var(--border-orange);
32-
--background-color: var(--orange-light);
33-
}
34-
35-
.root.cyan {
36-
--color: var(--cyan);
37-
--border: var(--border-cyan);
38-
--background-color: var(--cyan-light);
39-
}
4017
.title {
4118
color: var(--text-color);
4219
}
43-
.icon {
44-
border-right: var(--border);
45-
border-bottom: var(--border);
46-
border-left: var(--border);
47-
}
4820

4921
.top {
5022
height: var(--baseline);
@@ -62,6 +34,10 @@
6234
display: flex;
6335
justify-content: center;
6436
align-items: center;
37+
38+
border-right: var(--border);
39+
border-bottom: var(--border);
40+
border-left: var(--border);
6541
}
6642

6743
.top h2 {
@@ -98,7 +74,7 @@
9874
text-overflow: ellipsis;
9975
border-bottom: var(--border);
10076
border-left: var(--border);
101-
/* background-color: white; */
77+
background-color: var(--background-color);
10278
color: var(--text-color);
10379
}
10480

src/pages/guides.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ const GuidesPage = ({ data }) => {
8484
guide.cover?.file?.childImageSharp?.gatsbyImageData ??
8585
guidesPlaceholderImage
8686
}
87-
variant={variant}
8887
/>
8988
{i % 2 === 0 && (
9089
<div

0 commit comments

Comments
 (0)