@apify/ui-library 1.129.0 → 1.129.1

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": "@apify/ui-library",
3
- "version": "1.129.0",
3
+ "version": "1.129.1",
4
4
  "description": "React UI library used by apify.com",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -70,5 +70,5 @@
70
70
  "src",
71
71
  "style"
72
72
  ],
73
- "gitHead": "87c4357f05dcc81e71f9d2c3c53bed7df0c8877d"
73
+ "gitHead": "1ecb31c5ffe6b2aeb11e068bde70a04a8da7acb3"
74
74
  }
@@ -46,12 +46,12 @@ export const Default: Story = {
46
46
  />
47
47
  <CardContainer
48
48
  {...args}
49
- header={<>
49
+ header={
50
50
  <div>
51
51
  <CardContainer.Heading># Videos with this hashtag</CardContainer.Heading>
52
52
  <code style={{ marginLeft: 8 }}>Required</code>
53
53
  </div>
54
- </>}
54
+ }
55
55
  />
56
56
  <CardContainer
57
57
  {...args}
@@ -59,6 +59,9 @@ export const Default: Story = {
59
59
  Completely custom header content
60
60
  </>}
61
61
  />
62
+ <CardContainer {...args} header={null}>
63
+ Content without header
64
+ </CardContainer>
62
65
  </StoryWrapper>;
63
66
  },
64
67
  };
@@ -6,7 +6,7 @@ import type { ValueOf } from '@apify-packages/types';
6
6
  import { theme } from '../design_system/theme.js';
7
7
  import { Box, type BoxProps } from './box.js';
8
8
 
9
- const classNames = {
9
+ export const cardContainerClassNames = {
10
10
  CONTENT: 'CardContainer-Content',
11
11
  HEADER: 'CardContainer-Header',
12
12
  };
@@ -25,7 +25,7 @@ const Wrapper = styled(Box)<{$headerPlacement: ValueOf<typeof HEADER_PLACEMENT>}
25
25
  display: flex;
26
26
  flex-direction: ${({ $headerPlacement }) => ($headerPlacement === HEADER_PLACEMENT.TOP ? 'column' : 'column-reverse')};
27
27
 
28
- .${classNames.CONTENT} {
28
+ .${cardContainerClassNames.CONTENT} {
29
29
  /* Inner radius = outer radius - padding */
30
30
  border-radius: calc(${theme.radius.radius12} - ${theme.space.space2});
31
31
  background-color: ${theme.color.neutral.background};
@@ -34,7 +34,7 @@ const Wrapper = styled(Box)<{$headerPlacement: ValueOf<typeof HEADER_PLACEMENT>}
34
34
  flex-grow: 1;
35
35
  }
36
36
 
37
- .${classNames.HEADER} {
37
+ .${cardContainerClassNames.HEADER} {
38
38
  padding: ${theme.space.space4} ${theme.space.space8};
39
39
  display: flex;
40
40
  justify-content: space-between;
@@ -50,6 +50,7 @@ export type CardContainerProps = BoxProps & {
50
50
  /**
51
51
  * If string is passed, the correct styles are applied automatically.
52
52
  * In case of custom component, use `CardContainer.Heading` component to get the same styles.
53
+ * Pass `null` to render without a header section.
53
54
  */
54
55
  header: React.ReactNode,
55
56
  };
@@ -66,10 +67,12 @@ export const CardContainer = ({
66
67
  ...rest
67
68
  }: CardContainerProps) => (
68
69
  <Wrapper {...rest} $headerPlacement={headerPlacement}>
69
- <div className={classNames.HEADER}>
70
- {typeof header === 'string' ? <CardContainerHeading>{header}</CardContainerHeading> : header}
71
- </div>
72
- <div className={classNames.CONTENT}>
70
+ {header != null && (
71
+ <div className={cardContainerClassNames.HEADER}>
72
+ {typeof header === 'string' ? <CardContainerHeading>{header}</CardContainerHeading> : header}
73
+ </div>
74
+ )}
75
+ <div className={cardContainerClassNames.CONTENT}>
73
76
  {children}
74
77
  </div>
75
78
  </Wrapper>