Skip to content

Replaced all the css into tailwind css on FlatCard component #1788

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions components/Cards/FlatCard/FlatCard.js
Original file line number Diff line number Diff line change
@@ -3,7 +3,6 @@ import classNames from 'classnames';
import Image from 'next/image';
import { FLAT_CARD_IMAGE } from 'common/constants/testIDs';
import { getPlaceholder } from 'common/utils/next-utils';
import styles from './FlatCard.module.css';

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

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

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

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

<div className={styles.children}>{children}</div>
<div>{children}</div>

{Button && <div className={styles.flatCardButton}>{Button}</div>}
{Button && (
<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 ">
{Button}
</div>
)}
</div>
</article>
);
66 changes: 0 additions & 66 deletions components/Cards/FlatCard/FlatCard.module.css

This file was deleted.

Original file line number Diff line number Diff line change
@@ -2,13 +2,13 @@

exports[`FlatCard should render with many props assigned 1`] = `
<article
className="FlatCard test-class"
className="box-border my-6 mx-4 relative max-w-[400px] test-class"
>
<div
className="borderContainer"
className="p-8 border-4 border-solid border-themePrimary"
>
<div
className="header"
className="order-2 text-center"
>
<h1>
Main heading
@@ -18,11 +18,9 @@ exports[`FlatCard should render with many props assigned 1`] = `
</h6>
</div>
<hr
className="divider"
className="w-10/12 border-solid border-themePrimary"
/>
<div
className="children"
>
<div>
<p>
Example content goes here
</p>
@@ -31,7 +29,7 @@ exports[`FlatCard should render with many props assigned 1`] = `
</p>
</div>
<div
className="flatCardButton"
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 "
>
<a
className="Button primary"
@@ -48,14 +46,12 @@ exports[`FlatCard should render with many props assigned 1`] = `

exports[`FlatCard should render with required props 1`] = `
<article
className="FlatCard"
className="box-border my-6 mx-4 relative max-w-[400px]"
>
<div
className="borderContainer"
className="p-8 border-4 border-solid border-themePrimary"
>
<div
className="children"
>
<div>
<p>
Example content goes here
</p>