Skip to content

Commit d0e3626

Browse files
committed
fix style bugs with flatcard
1 parent 05675cb commit d0e3626

File tree

2 files changed

+17
-24
lines changed

2 files changed

+17
-24
lines changed

components/Cards/FlatCard/FlatCard.js

+13-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { element, node, shape, string } from 'prop-types';
22
import classNames from 'classnames';
3+
import { twMerge } from 'tailwind-merge';
34
import Image from 'next/image';
45
import { FLAT_CARD_IMAGE } from 'common/constants/testIDs';
56
import { getPlaceholder } from 'common/utils/next-utils';
@@ -31,28 +32,33 @@ function FlatCard({ button: Button, children, className, header, image }) {
3132
'pt-14': hasImage,
3233
})}
3334
>
34-
<div className="p-8 border-4 border-solid border-themePrimary">
35-
{header && <div className="order-2 text-center">{header}</div>}
35+
<div
36+
className={twMerge(
37+
'p-8 flex flex-col gap-5 border-4 border-solid border-themePrimary',
38+
hasImage && `pt-32`,
39+
)}
40+
>
41+
{header && <div className="text-center">{header}</div>}
3642

3743
{hasImage && (
38-
<div className="flex justify-center">
44+
<div className="flex justify-center -my-5">
3945
<div
4046
data-testid={FLAT_CARD_IMAGE}
41-
className="border-solid border-themePrimary border-[3px] order-1 absolute -top-4 h-52 [&>img]:object-cover"
47+
className="absolute -top-4 border-solid border-themePrimary border-[3px] w-[194px] h-[194px]"
4248
>
4349
<Image
4450
src={image.source}
4551
alt={image.alt ?? ''}
46-
width={194}
47-
height={194}
52+
layout="fill"
53+
objectFit
4854
placeholder="blur"
4955
blurDataURL={getPlaceholder(194, 194)}
5056
/>
5157
</div>
5258
</div>
5359
)}
5460

55-
{header && <hr className="w-10/12 border-solid border-themePrimary" />}
61+
{header && <hr className="w-full border-2 border-solid border-themePrimary" />}
5662

5763
<div>{children}</div>
5864

components/SuccessStory/SuccessStory.js

+4-17
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { string } from 'prop-types';
2-
import Image from 'next/image';
2+
import FlatCard from 'components/Cards/FlatCard/FlatCard';
33

44
SuccessStory.propTypes = {
55
imageSource: string.isRequired,
@@ -9,22 +9,9 @@ SuccessStory.propTypes = {
99

1010
function SuccessStory({ imageSource, quote, title }) {
1111
return (
12-
<div className="box-border flex flex-col flex-nowrap items-center my-12 mx-4 pt-14 relative max-w-[320px] h-[940px] md:h-[748px] sm:h-auto">
13-
<div className="absolute top-0 h-48 shadow-[1px_2px_5p_3px_rgba(0, 0, 0, 0.35)]">
14-
<Image
15-
alt={`${title} headshot`}
16-
src={imageSource}
17-
width={200}
18-
height={200}
19-
layout="fixed"
20-
/>
21-
</div>
22-
23-
<div className="flex flex-1 flex-col flex-nowrap items-center p-8 pt-40 border-2 border-solid border-themePrimary [&>blockquote]:my-4 [&>blockquote]:mx-0 [&>blockquote]:text-base">
24-
<h6 className="text-center text-base">{title}</h6>
25-
<blockquote>{`"${quote}"`}</blockquote>
26-
</div>
27-
</div>
12+
<FlatCard header={title} image={{ source: imageSource, alt: '' }}>
13+
<blockquote>{`"${quote}"`}</blockquote>
14+
</FlatCard>
2815
);
2916
}
3017

0 commit comments

Comments
 (0)