@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyphen/hyphen-components",
3
- "version": "4.4.2",
3
+ "version": "4.6.0",
4
4
  "license": "MIT",
5
5
  "author": {
6
6
  "name": "@hyphen"
@@ -24,8 +24,10 @@ export default meta;
24
24
 
25
25
  export const OverviewCard = () => (
26
26
  <Card>
27
- <Card.Header title="Card Overview" />
28
- <Card.Section>
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
- * Additional props to be spread to rendered element
11
+ * Description of the card, or element below the title
20
12
  */
21
- [x: string]: any; // eslint-disable-line
13
+ description?: ReactNode;
22
14
  }
23
15
 
24
16
  export const CardHeader: FC<CardHeaderProps> = ({
25
- childGap = '2xs',
26
- children = null,
27
- className = undefined,
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
- childGap={childGap}
45
- display={display}
46
- padding={padding}
47
- className={className}
24
+ padding="2xl"
25
+ direction="row"
26
+ gap="2xl"
27
+ width="100"
28
+ justifyContent="space-between"
48
29
  {...restProps}
49
30
  >
50
- {title && renderTitle()}
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
  );