Skip to content

Commit ab91e08

Browse files
subhajit20kylemh
andauthored
Converted all the css into Tailwind css of Badge component (#1739)
Co-authored-by: Kyle Holmberg <[email protected]> Co-authored-by: Kyle Holmberg <[email protected]>
1 parent adfdf0f commit ab91e08

File tree

6 files changed

+70
-75
lines changed

6 files changed

+70
-75
lines changed

.storybook/preview.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as viewports from '@storybook/addon-viewport';
44

55
export const decorators = [
66
Story => (
7-
<div style={{ margin: '2rem' }}>
7+
<div id="__next" style={{ margin: '2rem' }}>
88
<Story />
99
</div>
1010
),

components/Badge/Badge.js

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { bool, element, oneOfType, string } from 'prop-types';
22
import classNames from 'classnames';
3-
import styles from './Badge.module.css';
43

54
Badge.propTypes = {
65
className: string,
@@ -16,15 +15,30 @@ Badge.defaultProps = {
1615

1716
function Badge({ className, icon, isImageFirst, label }) {
1817
return (
19-
<figure className={classNames(styles.Badge, className)}>
18+
<figure
19+
className={classNames(
20+
'flex',
21+
'flex-col',
22+
'justify-items-center',
23+
'place-content-start',
24+
'm-2',
25+
'[&>svg]:fill-current',
26+
'[&>svg]:my-4',
27+
'[&>img]:mx-0',
28+
'[&>img]:h-24',
29+
'[&>svg]:mx-0',
30+
'[&>svg]:h-24',
31+
className,
32+
)}
33+
>
2034
{isImageFirst ? (
2135
<>
2236
{icon}
23-
<figcaption className={styles.label}>{label}</figcaption>
37+
<figcaption className="text-center whitespace-nowrap">{label}</figcaption>
2438
</>
2539
) : (
2640
<>
27-
<figcaption className={styles.label}>{label}</figcaption>
41+
<figcaption className="text-center whitespace-nowrap">{label}</figcaption>
2842
{icon}
2943
</>
3044
)}

components/Badge/Badge.module.css

Lines changed: 0 additions & 19 deletions
This file was deleted.

components/Badge/__tests__/__snapshots__/Badge.test.js.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
exports[`Badge should render with many props assigned 1`] = `
44
<figure
5-
className="Badge test-class"
5+
className="flex flex-col justify-items-center place-content-start m-2 [&>svg]:fill-current [&>svg]:my-4 [&>img]:mx-0 [&>img]:h-24 [&>svg]:mx-0 [&>svg]:h-24 test-class"
66
>
77
<svg />
88
<figcaption
9-
className="label"
9+
className="text-center whitespace-nowrap"
1010
>
1111
Badge Icon
1212
</figcaption>
@@ -15,11 +15,11 @@ exports[`Badge should render with many props assigned 1`] = `
1515

1616
exports[`Badge should render with required props 1`] = `
1717
<figure
18-
className="Badge"
18+
className="flex flex-col justify-items-center place-content-start m-2 [&>svg]:fill-current [&>svg]:my-4 [&>img]:mx-0 [&>img]:h-24 [&>svg]:mx-0 [&>svg]:h-24"
1919
>
2020
<svg />
2121
<figcaption
22-
className="label"
22+
className="text-center whitespace-nowrap"
2323
>
2424
Testing
2525
</figcaption>
Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.SchoolCard {
1+
:global(#__next) .SchoolCard {
22
width: 330px;
33
font-family: var(--primaryFontFamily), sans-serif;
44
border: 1px solid var(--primary);
@@ -12,18 +12,18 @@
1212
}
1313

1414
@media screen and (--large-viewport) {
15-
.SchoolCard {
15+
:global(#__next) .SchoolCard {
1616
width: 300px;
1717
}
1818
}
1919

2020
@media screen and (--small-viewport) {
21-
.SchoolCard {
21+
:global(#__next) .SchoolCard {
2222
width: 75vw;
2323
}
2424
}
2525

26-
.ribbon {
26+
:global(#__next) .ribbon {
2727
display: flex;
2828
align-items: center;
2929
justify-content: center;
@@ -41,24 +41,24 @@
4141
z-index: 1;
4242
}
4343

44-
.ribbon::before {
44+
:global(#__next) .ribbon::before {
4545
right: 100%;
4646
}
4747

48-
.ribbon::after {
48+
:global(#__next) .ribbon::after {
4949
left: 100%;
5050
}
5151

52-
.gi {
52+
:global(#__next) .gi {
5353
width: 85px;
5454
background: var(--secondary);
5555
color: var(--primary);
5656
}
5757

58-
.gi::before,
59-
.gi::after,
60-
.dual::before,
61-
.dual::after {
58+
:global(#__next) .gi::before,
59+
:global(#__next) .gi::after,
60+
:global(#__next) .dual::before,
61+
:global(#__next) .dual::after {
6262
content: "";
6363
position: absolute;
6464
top: 0;
@@ -68,15 +68,15 @@
6868
background: var(--secondary);
6969
}
7070

71-
.vettec {
71+
:global(#__next) .vettec {
7272
width: 85px;
7373
background: var(--primary);
7474
color: var(--secondary);
7575
padding: 1rem 0 0.1rem;
7676
}
7777

78-
.vettec::before,
79-
.vettec::after {
78+
:global(#__next) .vettec::before,
79+
:global(#__next) .vettec::after {
8080
content: "";
8181
position: absolute;
8282
top: 0;
@@ -86,46 +86,46 @@
8686
background: var(--primary);
8787
}
8888

89-
.dual {
89+
:global(#__next) .dual {
9090
width: 40px;
9191
background: var(--secondary);
9292
color: var(--primary);
9393
}
9494

95-
.cardBrand {
95+
:global(#__next) .cardBrand {
9696
padding: 0.25rem 0;
9797
margin: 1.5rem 0;
9898
}
9999

100-
.cardBrand > * {
100+
:global(#__next) .cardBrand > * {
101101
vertical-align: middle;
102102
}
103103

104-
.SchoolCard,
105-
.cardBlock {
104+
:global(#__next) .SchoolCard,
105+
:global(#__next) .cardBlock {
106106
box-sizing: border-box;
107107
}
108108

109-
.cardBlock {
109+
:global(#__next) .cardBlock {
110110
border-top: 1px solid var(--gray);
111111
display: flex;
112112
padding: 1rem 0.75rem;
113113
width: 100%;
114114
}
115115

116-
.cardBlockTitle {
116+
:global(#__next) .cardBlockTitle {
117117
font-weight: bold;
118118
display: block;
119119
margin-right: auto;
120120
padding-right: 6px;
121121
color: var(--secondary);
122122
}
123123

124-
.cardBlockValue {
124+
:global(#__next) .cardBlockValue {
125125
font-weight: normal;
126126
}
127127

128-
.SchoolCard .modalToggler {
128+
:global(#__next) .modalToggler {
129129
min-width: auto;
130130
text-transform: none;
131131
padding: 2px 6px 0;
@@ -136,19 +136,19 @@
136136
border: 2px solid var(--gray);
137137
}
138138

139-
.SchoolCard .modalToggler:hover {
139+
:global(#__next) .modalToggler:hover {
140140
background-color: transparent;
141141
color: var(--secondary);
142142
border-color: var(--gray);
143143
}
144144

145145
@media screen and (--large-viewport) {
146-
.SchoolCard .modalToggler {
146+
:global(#__next) .modalToggler {
147147
margin-top: -5px;
148148
}
149149
}
150150

151-
.badgeGroup {
151+
:global(#__next) .badgeGroup {
152152
display: grid;
153153
padding: 0.75rem 0;
154154
width: 100%;
@@ -157,44 +157,44 @@
157157
align-items: center;
158158
}
159159

160-
.active figcaption::after,
161-
.inactive figcaption::after {
160+
:global(#__next) .active figcaption::after,
161+
:global(#__next) .inactive figcaption::after {
162162
position: absolute;
163163
top: -0.75rem;
164164
right: 1rem;
165165
width: 1.25rem;
166166
}
167167

168-
.active figcaption::after {
168+
:global(#__next) .active figcaption::after {
169169
stroke: var(--successDeep);
170170
content: url("/static/images/icons/Custom/check-circle.svg");
171171
}
172172

173-
.inactive figcaption::after {
173+
:global(#__next) .inactive figcaption::after {
174174
stroke: var(--errorDeep);
175175
content: url("/static/images/icons/Custom/x-circle.svg");
176176
}
177177

178-
.badgeGroupItem.inactive {
178+
:global(#__next) .badgeGroupItem.inactive {
179179
opacity: 0.75;
180180
}
181181

182-
.badgeGroupItem.inactive figcaption::after {
182+
:global(#__next) .badgeGroupItem.inactive figcaption::after {
183183
opacity: 1;
184184
}
185185

186-
.badgeGroupItem {
186+
:global(#__next) .badgeGroupItem {
187187
margin: 0.75rem 0;
188188
position: relative;
189189
width: 95px;
190190
font-size: 15px;
191191
}
192192

193-
.badgeGroupItem svg {
193+
:global(#__next) .badgeGroupItem svg {
194194
height: 32px;
195195
margin: 0;
196196
}
197197

198-
.badgeGroupItem figcaption {
198+
:global(#__next) .badgeGroupItem figcaption {
199199
margin-top: 10px;
200200
}

styles/get_involved.module.css

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,60 @@
1-
.GetInvolved .ctaContainer {
1+
:global(#__next) .GetInvolved .ctaContainer {
22
display: flex;
33
width: 100%;
44
max-width: var(--typicalMaxWidth);
55
justify-content: space-evenly;
66
flex-wrap: wrap;
77
}
88

9-
.GetInvolved .ctaContainer > * {
9+
:global(#__next) .GetInvolved .ctaContainer > * {
1010
margin-top: 1rem;
1111
}
1212

13-
.GetInvolved .topMargin {
13+
:global(#__next) .GetInvolved .topMargin {
1414
margin-top: 1rem;
1515
}
1616

17-
.GetInvolved .extraTopMargin {
17+
:global(#__next) .GetInvolved .extraTopMargin {
1818
margin-top: 2rem;
1919
}
2020

21-
.GetInvolved .image {
21+
:global(#__next) .GetInvolved .image {
2222
margin: 2rem;
2323
max-width: 500px;
2424
}
2525

26-
.GetInvolved .cta {
26+
:global(#__next) .GetInvolved .cta {
2727
display: flex;
2828
flex-direction: column;
2929
}
3030

31-
.GetInvolved .centeredText {
31+
:global(#__next) .GetInvolved .centeredText {
3232
text-align: center;
3333
}
3434

35-
.GetInvolved .image img {
35+
:global(#__next) .GetInvolved .image img {
3636
max-width: 100%;
3737
opacity: 0;
3838
transition: opacity 1s;
3939
}
4040

41-
.GetInvolved .showImage img {
41+
:global(#__next) .GetInvolved .showImage img {
4242
opacity: 1;
4343
}
4444

45-
.GetInvolved .badgeGroupings {
45+
:global(#__next) .GetInvolved .badgeGroupings {
4646
display: flex;
4747
flex-wrap: wrap;
4848
justify-content: center;
4949
margin-top: -1rem;
5050
}
5151

52-
.GetInvolved .badge {
52+
:global(#__next) .GetInvolved .badge {
5353
margin: 1rem 4rem;
5454
}
5555

5656
@media screen and (--medium-viewport) {
57-
.GetInvolved .heroBannerMobilePositioning {
57+
:global(#__next) .GetInvolved .heroBannerMobilePositioning {
5858
background-position: 60% center;
5959
}
6060
}

0 commit comments

Comments
 (0)