Skip to content

Commit fab35b2

Browse files
committed
feat: update card styling
1 parent 20ca2d6 commit fab35b2

9 files changed

Lines changed: 14 additions & 15 deletions

src/@next/Card/Card.stories.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { BaseContainer } from '../../Layout/GlintsContainer/GlintsContainer';
55
import { Card, CardProps } from './Card';
66
import { Typography } from '../Typography';
77
import { Red } from '../utilities/colors';
8+
import styled from 'styled-components';
89

910
(Card as React.FunctionComponent<CardProps>).displayName = 'Card';
1011

@@ -144,16 +145,20 @@ SecondaryActionOnly.args = {
144145
};
145146

146147
const CustomHeadingSubHeadingTemplate: Story<CardProps> = args => {
148+
const StyledTypography = styled(Typography)`
149+
margin: 0;
150+
`;
151+
147152
const heading = (
148-
<Typography variant="subtitle1" color={Red.B74}>
153+
<StyledTypography variant="subtitle1" color={Red.B74}>
149154
Custom Heading
150-
</Typography>
155+
</StyledTypography>
151156
);
152157

153158
const subheading = (
154-
<Typography variant="subtitle2" color={Red.B65}>
159+
<StyledTypography variant="subtitle2" color={Red.B65}>
155160
Custom Sub Heading
156-
</Typography>
161+
</StyledTypography>
157162
);
158163

159164
return (

src/@next/Card/Card.tsx

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,9 @@ import {
1010
StyledCardHeaderSection,
1111
StyledCardHeaderSectionHalf,
1212
StyledCardHeaderWrapper,
13-
StyledCustomHeader,
1413
} from './CardStyle';
1514
import { Section } from './Section';
1615

17-
const PRIMITIVE_TYPES = ['string', 'number'];
18-
1916
export type CardProps = {
2017
heading?: React.ReactNode;
2118
subheading?: React.ReactNode;
@@ -36,20 +33,16 @@ const CardComponent = React.forwardRef<HTMLDivElement, CardProps>(function Card(
3633
}: CardProps,
3734
ref
3835
) {
39-
const headingMarkup = PRIMITIVE_TYPES.includes(typeof heading) ? (
40-
<Typography as="div" variant="body2">
36+
const headingMarkup = (
37+
<Typography as="div" variant="subtitle1">
4138
{heading}
4239
</Typography>
43-
) : (
44-
<StyledCustomHeader>{heading}</StyledCustomHeader>
4540
);
4641

47-
const subHeadingMarkup = PRIMITIVE_TYPES.includes(typeof subheading) ? (
42+
const subHeadingMarkup = (
4843
<Typography as="div" variant="subtitle2">
4944
{subheading}
5045
</Typography>
51-
) : (
52-
<StyledCustomHeader>{subheading}</StyledCustomHeader>
5346
);
5447

5548
const headerMarkup = () => {

src/@next/Card/CardStyle.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import { space12, space16, space24, space4 } from '../utilities/spacing';
66

77
export const StyledCardContainer = styled.div`
88
border-radius: ${borderRadius8};
9-
box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.05), 0px 1px 2px rgba(0, 0, 0, 0.15);
9+
box-shadow: 0px 0px 5px 0px rgba(71, 71, 71, 0.1),
10+
0px 1px 2px 0px rgba(71, 71, 71, 0.2);
1011
color: ${Neutral.B18};
1112
`;
1213

534 Bytes
Loading
533 Bytes
Loading
512 Bytes
Loading
505 Bytes
Loading
499 Bytes
Loading
494 Bytes
Loading

0 commit comments

Comments
 (0)