Skip to content

Commit 05675cb

Browse files
authored
Replaced all the css into tailwind css on FlatCard component (#1788)
1 parent 4bce3a1 commit 05675cb

File tree

3 files changed

+25
-89
lines changed

3 files changed

+25
-89
lines changed

components/Cards/FlatCard/FlatCard.js

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import classNames from 'classnames';
33
import Image from 'next/image';
44
import { FLAT_CARD_IMAGE } from 'common/constants/testIDs';
55
import { getPlaceholder } from 'common/utils/next-utils';
6-
import styles from './FlatCard.module.css';
76

87
FlatCard.propTypes = {
98
button: element,
@@ -28,16 +27,19 @@ function FlatCard({ button: Button, children, className, header, image }) {
2827

2928
return (
3029
<article
31-
className={classNames(styles.FlatCard, className, {
32-
[styles.cardWithImage]: hasImage,
30+
className={classNames('box-border my-6 mx-4 relative max-w-[400px]', className, {
31+
'pt-14': hasImage,
3332
})}
3433
>
35-
<div className={styles.borderContainer}>
36-
{header && <div className={styles.header}>{header}</div>}
34+
<div className="p-8 border-4 border-solid border-themePrimary">
35+
{header && <div className="order-2 text-center">{header}</div>}
3736

3837
{hasImage && (
39-
<div className={styles.rowCenter}>
40-
<div data-testid={FLAT_CARD_IMAGE} className={styles.imageWrapper}>
38+
<div className="flex justify-center">
39+
<div
40+
data-testid={FLAT_CARD_IMAGE}
41+
className="border-solid border-themePrimary border-[3px] order-1 absolute -top-4 h-52 [&>img]:object-cover"
42+
>
4143
<Image
4244
src={image.source}
4345
alt={image.alt ?? ''}
@@ -50,11 +52,15 @@ function FlatCard({ button: Button, children, className, header, image }) {
5052
</div>
5153
)}
5254

53-
{header && <hr className={styles.divider} />}
55+
{header && <hr className="w-10/12 border-solid border-themePrimary" />}
5456

55-
<div className={styles.children}>{children}</div>
57+
<div>{children}</div>
5658

57-
{Button && <div className={styles.flatCardButton}>{Button}</div>}
59+
{Button && (
60+
<div className="text-center absolute left-0 right-0 -bottom-7 [&>button]:hover:bg-white [&>button]:hover:text-themeSecondary [&>button]:focus-visible:text-themePrimary [&>button]:focus-visible:bg-white [&>a]:hover:bg-white [&>a]:hover:text-themeSecondary [&>a]:focus-visible:bg-white [&>a]:focus-visible:text-themeSecondary ">
61+
{Button}
62+
</div>
63+
)}
5864
</div>
5965
</article>
6066
);

components/Cards/FlatCard/FlatCard.module.css

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

components/Cards/FlatCard/__tests__/__snapshots__/FlatCard.test.js.snap

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

33
exports[`FlatCard should render with many props assigned 1`] = `
44
<article
5-
className="FlatCard test-class"
5+
className="box-border my-6 mx-4 relative max-w-[400px] test-class"
66
>
77
<div
8-
className="borderContainer"
8+
className="p-8 border-4 border-solid border-themePrimary"
99
>
1010
<div
11-
className="header"
11+
className="order-2 text-center"
1212
>
1313
<h1>
1414
Main heading
@@ -18,11 +18,9 @@ exports[`FlatCard should render with many props assigned 1`] = `
1818
</h6>
1919
</div>
2020
<hr
21-
className="divider"
21+
className="w-10/12 border-solid border-themePrimary"
2222
/>
23-
<div
24-
className="children"
25-
>
23+
<div>
2624
<p>
2725
Example content goes here
2826
</p>
@@ -31,7 +29,7 @@ exports[`FlatCard should render with many props assigned 1`] = `
3129
</p>
3230
</div>
3331
<div
34-
className="flatCardButton"
32+
className="text-center absolute left-0 right-0 -bottom-7 [&>button]:hover:bg-white [&>button]:hover:text-themeSecondary [&>button]:focus-visible:text-themePrimary [&>button]:focus-visible:bg-white [&>a]:hover:bg-white [&>a]:hover:text-themeSecondary [&>a]:focus-visible:bg-white [&>a]:focus-visible:text-themeSecondary "
3533
>
3634
<a
3735
className="Button primary"
@@ -48,14 +46,12 @@ exports[`FlatCard should render with many props assigned 1`] = `
4846

4947
exports[`FlatCard should render with required props 1`] = `
5048
<article
51-
className="FlatCard"
49+
className="box-border my-6 mx-4 relative max-w-[400px]"
5250
>
5351
<div
54-
className="borderContainer"
52+
className="p-8 border-4 border-solid border-themePrimary"
5553
>
56-
<div
57-
className="children"
58-
>
54+
<div>
5955
<p>
6056
Example content goes here
6157
</p>

0 commit comments

Comments
 (0)