@hyphen/hyphen-components 4.4.2 → 4.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Card/components/CardHeader/CardHeader.d.ts +2 -10
- package/dist/hyphen-components.cjs.development.js +21 -24
- package/dist/hyphen-components.cjs.development.js.map +1 -1
- package/dist/hyphen-components.cjs.production.min.js +1 -1
- package/dist/hyphen-components.cjs.production.min.js.map +1 -1
- package/dist/hyphen-components.esm.js +21 -24
- package/dist/hyphen-components.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Card/Card.stories.tsx +4 -2
- package/src/components/Card/components/CardHeader/CardHeader.tsx +34 -30
package/package.json
CHANGED
|
@@ -24,8 +24,10 @@ export default meta;
|
|
|
24
24
|
|
|
25
25
|
export const OverviewCard = () => (
|
|
26
26
|
<Card>
|
|
27
|
-
<Card.Header title="Card Overview"
|
|
28
|
-
|
|
27
|
+
<Card.Header title="Card Overview" description="This is the description">
|
|
28
|
+
<Button size="sm">action</Button>
|
|
29
|
+
</Card.Header>
|
|
30
|
+
<Card.Section title="Section One">
|
|
29
31
|
<p>Card content</p>
|
|
30
32
|
</Card.Section>
|
|
31
33
|
<Card.Section title="Section Two">Another section</Card.Section>
|
|
@@ -3,51 +3,55 @@ import { Box, BoxProps } from '../../../Box/Box';
|
|
|
3
3
|
import { Heading } from '../../../Heading/Heading';
|
|
4
4
|
|
|
5
5
|
export interface CardHeaderProps extends BoxProps {
|
|
6
|
-
/**
|
|
7
|
-
* contents of the Header
|
|
8
|
-
*/
|
|
9
|
-
children?: ReactNode;
|
|
10
|
-
/**
|
|
11
|
-
* Additional class names to add
|
|
12
|
-
*/
|
|
13
|
-
className?: string;
|
|
14
6
|
/**
|
|
15
7
|
* The title of the card
|
|
16
8
|
*/
|
|
17
9
|
title?: ReactNode;
|
|
18
10
|
/**
|
|
19
|
-
*
|
|
11
|
+
* Description of the card, or element below the title
|
|
20
12
|
*/
|
|
21
|
-
|
|
13
|
+
description?: ReactNode;
|
|
22
14
|
}
|
|
23
15
|
|
|
24
16
|
export const CardHeader: FC<CardHeaderProps> = ({
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
display = 'block',
|
|
29
|
-
padding = '2xl',
|
|
30
|
-
title = null,
|
|
17
|
+
children,
|
|
18
|
+
title,
|
|
19
|
+
description,
|
|
31
20
|
...restProps
|
|
32
21
|
}) => {
|
|
33
|
-
const renderTitle = () =>
|
|
34
|
-
typeof title === 'string' ? (
|
|
35
|
-
<Heading size="sm" as="h4">
|
|
36
|
-
{title}
|
|
37
|
-
</Heading>
|
|
38
|
-
) : (
|
|
39
|
-
title
|
|
40
|
-
);
|
|
41
|
-
|
|
42
22
|
return (
|
|
43
23
|
<Box
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
24
|
+
padding="2xl"
|
|
25
|
+
direction="row"
|
|
26
|
+
gap="2xl"
|
|
27
|
+
width="100"
|
|
28
|
+
justifyContent="space-between"
|
|
48
29
|
{...restProps}
|
|
49
30
|
>
|
|
50
|
-
|
|
31
|
+
<Box gap="2xs">
|
|
32
|
+
{title && (
|
|
33
|
+
<>
|
|
34
|
+
{typeof title === 'string' ? (
|
|
35
|
+
<Heading size="sm" as="h4">
|
|
36
|
+
{title}
|
|
37
|
+
</Heading>
|
|
38
|
+
) : (
|
|
39
|
+
title
|
|
40
|
+
)}
|
|
41
|
+
</>
|
|
42
|
+
)}
|
|
43
|
+
{description && (
|
|
44
|
+
<>
|
|
45
|
+
{typeof description === 'string' ? (
|
|
46
|
+
<Box fontSize={{ base: 'xs', tablet: 'sm' }} color="secondary">
|
|
47
|
+
{description}
|
|
48
|
+
</Box>
|
|
49
|
+
) : (
|
|
50
|
+
description
|
|
51
|
+
)}
|
|
52
|
+
</>
|
|
53
|
+
)}
|
|
54
|
+
</Box>
|
|
51
55
|
{children}
|
|
52
56
|
</Box>
|
|
53
57
|
);
|