@apify/ui-library 0.71.1-featcolortokens-178953.56 → 0.71.1-featcolortokens-178953.63
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/src/design_system/colors/generated/{dark.d.ts → css_variables.dark.d.ts} +1 -1
- package/dist/src/design_system/colors/generated/css_variables.dark.d.ts.map +1 -0
- package/dist/src/design_system/colors/generated/{dark.js → css_variables.dark.js} +1 -1
- package/dist/src/design_system/colors/generated/css_variables.dark.js.map +1 -0
- package/dist/src/design_system/colors/generated/{light.d.ts → css_variables.light.d.ts} +1 -1
- package/dist/src/design_system/colors/generated/css_variables.light.d.ts.map +1 -0
- package/{src/design_system/colors/generated/light.ts → dist/src/design_system/colors/generated/css_variables.light.js} +1 -1
- package/dist/src/design_system/colors/generated/css_variables.light.js.map +1 -0
- package/dist/src/design_system/colors/generated/{palette.dark.d.ts → css_variables_palette.dark.d.ts} +1 -1
- package/dist/src/design_system/colors/generated/css_variables_palette.dark.d.ts.map +1 -0
- package/dist/src/design_system/colors/generated/{palette.dark.js → css_variables_palette.dark.js} +1 -1
- package/dist/src/design_system/colors/generated/css_variables_palette.dark.js.map +1 -0
- package/dist/src/design_system/colors/generated/{palette.light.d.ts → css_variables_palette.light.d.ts} +1 -1
- package/dist/src/design_system/colors/generated/css_variables_palette.light.d.ts.map +1 -0
- package/{src/design_system/colors/generated/palette.light.ts → dist/src/design_system/colors/generated/css_variables_palette.light.js} +1 -1
- package/dist/src/design_system/colors/generated/css_variables_palette.light.js.map +1 -0
- package/dist/src/design_system/colors/index.d.ts +4 -4
- package/dist/src/design_system/colors/index.d.ts.map +1 -1
- package/dist/src/design_system/colors/index.js +4 -4
- package/dist/src/design_system/colors/index.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/package.json +7 -5
- package/.stylelintrc +0 -12
- package/CHANGELOG.md +0 -3334
- package/CODEOWNERS +0 -7
- package/dist/src/design_system/colors/generated/dark.d.ts.map +0 -1
- package/dist/src/design_system/colors/generated/dark.js.map +0 -1
- package/dist/src/design_system/colors/generated/light.d.ts.map +0 -1
- package/dist/src/design_system/colors/generated/light.js +0 -147
- package/dist/src/design_system/colors/generated/light.js.map +0 -1
- package/dist/src/design_system/colors/generated/palette.dark.d.ts.map +0 -1
- package/dist/src/design_system/colors/generated/palette.dark.js.map +0 -1
- package/dist/src/design_system/colors/generated/palette.light.d.ts.map +0 -1
- package/dist/src/design_system/colors/generated/palette.light.js +0 -74
- package/dist/src/design_system/colors/generated/palette.light.js.map +0 -1
- package/dist/src/design_system/colors_theme.d.ts +0 -213
- package/dist/src/design_system/colors_theme.d.ts.map +0 -1
- package/dist/src/design_system/colors_theme.js +0 -213
- package/dist/src/design_system/colors_theme.js.map +0 -1
- package/dist/src/design_system/properties_theme.d.ts +0 -175
- package/dist/src/design_system/properties_theme.d.ts.map +0 -1
- package/dist/src/design_system/properties_theme.js +0 -315
- package/dist/src/design_system/properties_theme.js.map +0 -1
- package/eslint.config.mjs +0 -44
- package/src/codemods/generate_typograpy_tokens_files.mjs +0 -137
- package/src/components/action_link.tsx +0 -60
- package/src/components/actor_template_card.tsx +0 -116
- package/src/components/badge.tsx +0 -148
- package/src/components/banner.tsx +0 -94
- package/src/components/blog_article.tsx +0 -85
- package/src/components/box.tsx +0 -127
- package/src/components/button.tsx +0 -305
- package/src/components/chip.tsx +0 -128
- package/src/components/code/action_button.tsx +0 -96
- package/src/components/code/code_block/code_block.styled.tsx +0 -180
- package/src/components/code/code_block/code_block.tsx +0 -224
- package/src/components/code/code_block/code_block_with_tabs.tsx +0 -257
- package/src/components/code/code_block/utils.tsx +0 -67
- package/src/components/code/index.ts +0 -5
- package/src/components/code/inline_code/inline_code.tsx +0 -62
- package/src/components/code/one_line_code/one_line_code.tsx +0 -228
- package/src/components/code/prism_highlighter.tsx +0 -180
- package/src/components/color_wheel_gradient.tsx +0 -31
- package/src/components/floating/index.ts +0 -3
- package/src/components/floating/menu.tsx +0 -189
- package/src/components/floating/menu_common.tsx +0 -31
- package/src/components/floating/menu_components.tsx +0 -99
- package/src/components/image.tsx +0 -24
- package/src/components/index.ts +0 -22
- package/src/components/link.tsx +0 -114
- package/src/components/message.tsx +0 -153
- package/src/components/rating.tsx +0 -106
- package/src/components/readme_renderer/index.ts +0 -3
- package/src/components/readme_renderer/pythonize_value.ts +0 -76
- package/src/components/readme_renderer/table_of_contents.tsx +0 -272
- package/src/components/readme_renderer/utils.tsx +0 -46
- package/src/components/simple_markdown/index.ts +0 -2
- package/src/components/simple_markdown/simple_markdown.tsx +0 -214
- package/src/components/simple_markdown/simple_markdown_components.tsx +0 -293
- package/src/components/tabs/index.ts +0 -2
- package/src/components/tabs/tab.tsx +0 -217
- package/src/components/tabs/tabs.tsx +0 -169
- package/src/components/tag.tsx +0 -196
- package/src/components/text/heading_content.tsx +0 -56
- package/src/components/text/heading_marketing.tsx +0 -55
- package/src/components/text/heading_shared.tsx +0 -55
- package/src/components/text/index.ts +0 -19
- package/src/components/text/text_base.tsx +0 -52
- package/src/components/text/text_content.tsx +0 -104
- package/src/components/text/text_marketing.tsx +0 -152
- package/src/components/text/text_shared.tsx +0 -95
- package/src/components/tile/horizontal_tile.tsx +0 -77
- package/src/components/tile/index.ts +0 -2
- package/src/components/tile/shared.ts +0 -27
- package/src/components/tile/vertical_tile.tsx +0 -59
- package/src/components/to_consolidate/card.tsx +0 -141
- package/src/components/to_consolidate/index.ts +0 -4
- package/src/components/to_consolidate/markdown.tsx +0 -609
- package/src/components/to_consolidate/pagination.tsx +0 -136
- package/src/components/to_consolidate/tab_number_chip.tsx +0 -31
- package/src/design_system/colors/build_color_tokens.js +0 -175
- package/src/design_system/colors/figma_color_tokens.dark.json +0 -886
- package/src/design_system/colors/figma_color_tokens.light.json +0 -886
- package/src/design_system/colors/generated/colors_theme.dark.ts +0 -110
- package/src/design_system/colors/generated/colors_theme.light.ts +0 -110
- package/src/design_system/colors/generated/dark.ts +0 -147
- package/src/design_system/colors/generated/palette.dark.ts +0 -74
- package/src/design_system/colors/generated/properties_theme.ts +0 -179
- package/src/design_system/colors/index.ts +0 -7
- package/src/design_system/colors_theme.ts +0 -213
- package/src/design_system/properties_theme.ts +0 -453
- package/src/design_system/supernova_typography_tokens.json +0 -657
- package/src/design_system/theme.ts +0 -25
- package/src/design_system/tokens/index.ts +0 -5
- package/src/design_system/tokens/layouts.ts +0 -29
- package/src/design_system/tokens/radiuses.ts +0 -22
- package/src/design_system/tokens/shadows.ts +0 -22
- package/src/design_system/tokens/spaces.ts +0 -15
- package/src/design_system/tokens/transitions.ts +0 -19
- package/src/design_system/typography_theme.ts +0 -197
- package/src/index.ts +0 -8
- package/src/type_utils.ts +0 -7
- package/src/ui_dependency_provider.tsx +0 -58
- package/src/utils/copy_to_clipboard.ts +0 -24
- package/src/utils/image_color.ts +0 -42
- package/src/utils/index.ts +0 -4
- package/src/utils/resize_observer.ts +0 -18
- package/src/utils/sanitization.ts +0 -14
- package/tsconfig.build.json +0 -17
- package/tsconfig.json +0 -10
- /package/{src/design_system/colors/generated → style/colors}/dark.scss +0 -0
- /package/{src/design_system/colors/generated → style/colors}/light.scss +0 -0
- /package/{src/design_system/colors/generated → style/colors}/palette.dark.scss +0 -0
- /package/{src/design_system/colors/generated → style/colors}/palette.light.scss +0 -0
package/src/components/badge.tsx
DELETED
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react';
|
|
2
|
-
import styled, { css, type FlattenSimpleInterpolation } from 'styled-components';
|
|
3
|
-
|
|
4
|
-
import type { IconComponent, IconSize } from '@apify/ui-icons';
|
|
5
|
-
|
|
6
|
-
import { theme } from '../design_system/theme.js';
|
|
7
|
-
import type { WithTransientProps } from '../type_utils.js';
|
|
8
|
-
import { Box, type MarginSpacingProps, type RegularBoxProps } from './box.js';
|
|
9
|
-
import { Text } from './text/index.js';
|
|
10
|
-
import type { SharedTextSize, SharedTextType } from './text/text_shared.js';
|
|
11
|
-
|
|
12
|
-
export type BadgeSize = 'regular' | 'small' | 'extra_small';
|
|
13
|
-
export const BADGE_SIZES: BadgeSize[] = ['regular', 'small'];
|
|
14
|
-
|
|
15
|
-
const BADGE_ICON_SIZES = {
|
|
16
|
-
regular: '16',
|
|
17
|
-
small: '12',
|
|
18
|
-
extra_small: '12',
|
|
19
|
-
} satisfies Record<BadgeSize, IconSize>;
|
|
20
|
-
|
|
21
|
-
const BADGE_TEXT_SIZES = {
|
|
22
|
-
regular: 'regular',
|
|
23
|
-
small: 'small',
|
|
24
|
-
extra_small: 'small',
|
|
25
|
-
} satisfies Record<BadgeSize, SharedTextSize>;
|
|
26
|
-
|
|
27
|
-
export const BADGE_VARIANTS = ['neutral', 'neutral_muted', 'neutral_subtle', 'primary_black', 'primary_blue', 'success', 'warning', 'danger'] as const;
|
|
28
|
-
type BadgeVariant = typeof BADGE_VARIANTS[number];
|
|
29
|
-
|
|
30
|
-
type SharedBadgeProps = Omit<RegularBoxProps, 'as' | 'onClick'> & MarginSpacingProps;
|
|
31
|
-
export type BadgeProps = SharedBadgeProps & {
|
|
32
|
-
as?: Exclude<React.ElementType, 'a' | 'button'>;
|
|
33
|
-
size?: BadgeSize;
|
|
34
|
-
type?: SharedTextType;
|
|
35
|
-
variant?: BadgeVariant;
|
|
36
|
-
LeadingIcon?: IconComponent;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const badgeSizeStyle = {
|
|
40
|
-
regular: css`
|
|
41
|
-
padding: ${theme.space.space4} ${theme.space.space8};
|
|
42
|
-
border-radius: ${theme.radius.radius6};
|
|
43
|
-
`,
|
|
44
|
-
small: css`
|
|
45
|
-
height: 2rem;
|
|
46
|
-
padding: ${theme.space.space2} ${theme.space.space6};
|
|
47
|
-
border-radius: ${theme.radius.radius4};
|
|
48
|
-
`,
|
|
49
|
-
extra_small: css`
|
|
50
|
-
height: ${theme.space.space16};
|
|
51
|
-
padding: ${theme.space.space2} ${theme.space.space4};
|
|
52
|
-
border-radius: ${theme.radius.radius4};
|
|
53
|
-
`,
|
|
54
|
-
} satisfies Record<BadgeSize, FlattenSimpleInterpolation>;
|
|
55
|
-
|
|
56
|
-
const badgeVariantStyle = {
|
|
57
|
-
neutral: css`
|
|
58
|
-
color: ${theme.color.neutral.text};
|
|
59
|
-
fill: ${theme.color.neutral.text};
|
|
60
|
-
background: ${theme.color.neutral.background};
|
|
61
|
-
box-shadow: inset 0 0 0 1px ${theme.color.neutral.border};
|
|
62
|
-
`,
|
|
63
|
-
neutral_muted: css`
|
|
64
|
-
color: ${theme.color.neutral.text};
|
|
65
|
-
fill: ${theme.color.neutral.text};
|
|
66
|
-
background: ${theme.color.neutral.chipBackground};
|
|
67
|
-
`,
|
|
68
|
-
neutral_subtle: css`
|
|
69
|
-
color: ${theme.color.neutral.textSubtle};
|
|
70
|
-
fill: ${theme.color.neutral.textSubtle};
|
|
71
|
-
background: ${theme.color.neutral.backgroundSubtle};
|
|
72
|
-
`,
|
|
73
|
-
primary_black: css`
|
|
74
|
-
color: ${theme.color.primaryBlack.chipText};
|
|
75
|
-
fill: ${theme.color.primaryBlack.chipText};
|
|
76
|
-
background: ${theme.color.primaryBlack.background};
|
|
77
|
-
`,
|
|
78
|
-
primary_blue: css`
|
|
79
|
-
color: ${theme.color.primary.chipText};
|
|
80
|
-
fill: ${theme.color.primaryBlack.chipText};
|
|
81
|
-
background: ${theme.color.primary.background};
|
|
82
|
-
`,
|
|
83
|
-
success: css`
|
|
84
|
-
color: ${theme.color.success.chipText};
|
|
85
|
-
fill: ${theme.color.success.chipText};
|
|
86
|
-
background: ${theme.color.success.background};
|
|
87
|
-
`,
|
|
88
|
-
warning: css`
|
|
89
|
-
color: ${theme.color.warning.chipText};
|
|
90
|
-
fill: ${theme.color.warning.chipText};
|
|
91
|
-
background: ${theme.color.warning.background};
|
|
92
|
-
`,
|
|
93
|
-
danger: css`
|
|
94
|
-
color: ${theme.color.danger.chipText};
|
|
95
|
-
fill: ${theme.color.danger.chipText};
|
|
96
|
-
background: ${theme.color.danger.background};
|
|
97
|
-
`,
|
|
98
|
-
} satisfies Record<BadgeVariant, FlattenSimpleInterpolation>;
|
|
99
|
-
|
|
100
|
-
type StyledBadgeProps = WithTransientProps<
|
|
101
|
-
Required<Pick<BadgeProps, 'size' | 'variant'>>
|
|
102
|
-
>;
|
|
103
|
-
|
|
104
|
-
const StyledBadge = styled(Box)<StyledBadgeProps>`
|
|
105
|
-
${({ $size }) => badgeSizeStyle[$size]};
|
|
106
|
-
${({ $variant }) => badgeVariantStyle[$variant]};
|
|
107
|
-
|
|
108
|
-
/* Static styles */
|
|
109
|
-
width: fit-content;
|
|
110
|
-
border: none;
|
|
111
|
-
outline: none;
|
|
112
|
-
display: flex;
|
|
113
|
-
flex-direction: row;
|
|
114
|
-
justify-content: center;
|
|
115
|
-
align-items: center;
|
|
116
|
-
white-space: nowrap;
|
|
117
|
-
gap: ${theme.space.space4};
|
|
118
|
-
`;
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Component for displaying non-interactive chip descendant.
|
|
122
|
-
*/
|
|
123
|
-
export const Badge = forwardRef(
|
|
124
|
-
({
|
|
125
|
-
size = 'small',
|
|
126
|
-
type = 'body',
|
|
127
|
-
variant = 'neutral',
|
|
128
|
-
LeadingIcon,
|
|
129
|
-
children,
|
|
130
|
-
...props
|
|
131
|
-
}: BadgeProps,
|
|
132
|
-
ref,
|
|
133
|
-
) => {
|
|
134
|
-
return (
|
|
135
|
-
<StyledBadge
|
|
136
|
-
ref={ref}
|
|
137
|
-
$size={size}
|
|
138
|
-
$variant={variant}
|
|
139
|
-
{...props}
|
|
140
|
-
>
|
|
141
|
-
{LeadingIcon && <LeadingIcon size={BADGE_ICON_SIZES[size]} />}
|
|
142
|
-
{children && (<Text size={BADGE_TEXT_SIZES[size]} type={type} weight="medium">{children}</Text>)}
|
|
143
|
-
</StyledBadge>
|
|
144
|
-
);
|
|
145
|
-
},
|
|
146
|
-
);
|
|
147
|
-
|
|
148
|
-
Badge.displayName = 'Badge';
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import styled, { css } from 'styled-components';
|
|
3
|
-
|
|
4
|
-
import { theme } from '../design_system/theme.js';
|
|
5
|
-
|
|
6
|
-
const BANNER_GRADIENT_BACKGROUND_SVG = `<svg width="1200" height="148" viewBox="0 0 1200 148" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
7
|
-
<g clip-path="url(#clip0_2285_34756)">
|
|
8
|
-
<g filter="url(#filter0_f_2285_34756)">
|
|
9
|
-
<path d="M-39.7702 191.085C-55.0622 193.205 -68.8864 201.311 -78.2029 213.621C-87.5194 225.932 -91.5654 241.438 -89.4512 256.731L-55.0077 502.652L89.8852 173L-39.7702 191.085Z" fill="url(#paint0_linear_2285_34756)"/>
|
|
10
|
-
</g>
|
|
11
|
-
<g filter="url(#filter1_f_2285_34756)">
|
|
12
|
-
<path d="M1267.53 398.062L1253.99 209.002C1252.85 193.626 1245.67 179.327 1234.01 169.234C1222.36 159.14 1207.18 154.073 1191.8 155.14C1190.5 155.19 1189.2 155.331 1187.92 155.564L1132 163.289L1254.84 438.685C1264.05 427.236 1268.59 412.721 1267.53 398.062Z" fill="url(#paint1_linear_2285_34756)"/>
|
|
13
|
-
</g>
|
|
14
|
-
<g filter="url(#filter2_f_2285_34756)">
|
|
15
|
-
<path d="M561 29.7691C570.917 30.4746 580.956 29.5571 590.142 27.1057L801.075 -28.7862L700.682 -170L561 29.7691Z" fill="url(#paint2_linear_2285_34756)"/>
|
|
16
|
-
</g>
|
|
17
|
-
</g>
|
|
18
|
-
<defs>
|
|
19
|
-
<filter id="filter0_f_2285_34756" x="-170" y="93" width="339.885" height="489.652" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
|
20
|
-
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
|
21
|
-
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
|
|
22
|
-
<feGaussianBlur stdDeviation="40" result="effect1_foregroundBlur_2285_34756"/>
|
|
23
|
-
</filter>
|
|
24
|
-
<filter id="filter1_f_2285_34756" x="1052" y="75" width="295.683" height="443.686" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
|
25
|
-
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
|
26
|
-
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
|
|
27
|
-
<feGaussianBlur stdDeviation="40" result="effect1_foregroundBlur_2285_34756"/>
|
|
28
|
-
</filter>
|
|
29
|
-
<filter id="filter2_f_2285_34756" x="481" y="-250" width="400.074" height="360" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
|
30
|
-
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
|
31
|
-
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
|
|
32
|
-
<feGaussianBlur stdDeviation="40" result="effect1_foregroundBlur_2285_34756"/>
|
|
33
|
-
</filter>
|
|
34
|
-
<linearGradient id="paint0_linear_2285_34756" x1="-0.0574112" y1="173" x2="-0.0574112" y2="502.652" gradientUnits="userSpaceOnUse">
|
|
35
|
-
<stop stop-color="#00FF85"/>
|
|
36
|
-
<stop offset="1" stop-color="#00FF47" stop-opacity="0"/>
|
|
37
|
-
</linearGradient>
|
|
38
|
-
<linearGradient id="paint1_linear_2285_34756" x1="1146.02" y1="174.549" x2="1333.1" y2="293.915" gradientUnits="userSpaceOnUse">
|
|
39
|
-
<stop stop-color="#00FFF0"/>
|
|
40
|
-
<stop offset="1" stop-color="#1672EB"/>
|
|
41
|
-
</linearGradient>
|
|
42
|
-
<linearGradient id="paint2_linear_2285_34756" x1="681.037" y1="-170" x2="681.037" y2="30" gradientUnits="userSpaceOnUse">
|
|
43
|
-
<stop stop-color="#F5B315"/>
|
|
44
|
-
<stop offset="1" stop-color="#FF2CC4"/>
|
|
45
|
-
</linearGradient>
|
|
46
|
-
<clipPath id="clip0_2285_34756">
|
|
47
|
-
<rect width="1200" height="1791.08" rx="16" fill="white"/>
|
|
48
|
-
</clipPath>
|
|
49
|
-
</defs>
|
|
50
|
-
</svg>
|
|
51
|
-
`;
|
|
52
|
-
|
|
53
|
-
interface BannerProps {
|
|
54
|
-
background?: string,
|
|
55
|
-
useGradientBackground?: boolean,
|
|
56
|
-
width?: string,
|
|
57
|
-
className?: string,
|
|
58
|
-
children: React.ReactNode,
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const getBannerBackground = (background?: string, useGradientBackground?: boolean) => {
|
|
62
|
-
return css`
|
|
63
|
-
background-color: ${background || theme.color.neutral.backgroundSubtle};
|
|
64
|
-
${useGradientBackground && `
|
|
65
|
-
background-image: url("data:image/svg+xml,${encodeURIComponent(BANNER_GRADIENT_BACKGROUND_SVG)}");
|
|
66
|
-
background-position: center;
|
|
67
|
-
background-repeat: no-repeat;
|
|
68
|
-
background-size: cover;
|
|
69
|
-
`}
|
|
70
|
-
`;
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
const StyledBanner = styled.div<{ $background?: string, $useGradientBackground?: boolean, width?: string }>`
|
|
74
|
-
width: ${(props) => props.width || '100%'};
|
|
75
|
-
padding: ${theme.space.space40} ${theme.space.space80};
|
|
76
|
-
border-radius: ${theme.radius.radius16};
|
|
77
|
-
|
|
78
|
-
${({ $background, $useGradientBackground }) => getBannerBackground($background, $useGradientBackground)};
|
|
79
|
-
`;
|
|
80
|
-
|
|
81
|
-
export const Banner: React.FC<BannerProps> = ({
|
|
82
|
-
useGradientBackground = true,
|
|
83
|
-
background,
|
|
84
|
-
children,
|
|
85
|
-
...otherProps
|
|
86
|
-
}) => (
|
|
87
|
-
<StyledBanner
|
|
88
|
-
$background={background}
|
|
89
|
-
$useGradientBackground={useGradientBackground}
|
|
90
|
-
{...otherProps}
|
|
91
|
-
>
|
|
92
|
-
{children}
|
|
93
|
-
</StyledBanner>
|
|
94
|
-
);
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import styled from 'styled-components';
|
|
3
|
-
|
|
4
|
-
import { ArrowRightIcon } from '@apify/ui-icons';
|
|
5
|
-
|
|
6
|
-
import { theme } from '../design_system/theme.js';
|
|
7
|
-
|
|
8
|
-
const classNames = {
|
|
9
|
-
IMAGE_WRAPPER: 'ImageWrapper',
|
|
10
|
-
TEXT: 'Text',
|
|
11
|
-
READ_POST: 'ReadPost',
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const BlogArticleWrapper = styled.div`
|
|
15
|
-
display: flex;
|
|
16
|
-
flex-direction: column;
|
|
17
|
-
|
|
18
|
-
&:hover {
|
|
19
|
-
.${classNames.READ_POST} {
|
|
20
|
-
color: ${theme.color.primary.action};
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.${classNames.IMAGE_WRAPPER} {
|
|
25
|
-
margin-bottom: ${theme.space.space16};
|
|
26
|
-
border-radius: ${theme.radius.radius12};
|
|
27
|
-
border: 1px solid ${theme.color.neutral.backgroundSubtle};
|
|
28
|
-
aspect-ratio: 16/9;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.${classNames.TEXT} {
|
|
32
|
-
padding-bottom: ${theme.space.space16};
|
|
33
|
-
color: ${theme.color.neutral.text};
|
|
34
|
-
${theme.typography.shared.mobile.titleL}
|
|
35
|
-
|
|
36
|
-
@media (min-width: ${theme.layout.tablet}) {
|
|
37
|
-
${theme.typography.shared.tablet.titleL}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
@media (min-width: ${theme.layout.desktop}) {
|
|
41
|
-
${theme.typography.shared.desktop.titleL}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.${classNames.READ_POST} {
|
|
46
|
-
display: flex;
|
|
47
|
-
align-items: center;
|
|
48
|
-
gap: ${theme.space.space4};
|
|
49
|
-
color: ${theme.color.neutral.textMuted};
|
|
50
|
-
${theme.typography.shared.mobile.titleM}
|
|
51
|
-
|
|
52
|
-
@media (min-width: ${theme.layout.tablet}) {
|
|
53
|
-
${theme.typography.shared.tablet.titleM}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
@media (min-width: ${theme.layout.desktop}) {
|
|
57
|
-
${theme.typography.shared.desktop.titleM}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
svg {
|
|
62
|
-
transition: margin-right .5s;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
&:hover svg {
|
|
66
|
-
margin-right: ${theme.space.space4};
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
`;
|
|
70
|
-
|
|
71
|
-
interface BlogArticleProps {
|
|
72
|
-
imageNode: React.ReactNode;
|
|
73
|
-
title: string;
|
|
74
|
-
ctaTitle?: string;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export function BlogArticle({ imageNode, title, ctaTitle = 'Read more' }: BlogArticleProps) {
|
|
78
|
-
return (
|
|
79
|
-
<BlogArticleWrapper>
|
|
80
|
-
<div className={classNames.IMAGE_WRAPPER}>{imageNode}</div>
|
|
81
|
-
<div className={classNames.TEXT}>{title}</div>
|
|
82
|
-
<div className={classNames.READ_POST}>{ctaTitle}<ArrowRightIcon size="16" title="" titleId="" /></div>
|
|
83
|
-
</BlogArticleWrapper>
|
|
84
|
-
);
|
|
85
|
-
}
|
package/src/components/box.tsx
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react';
|
|
2
|
-
import styled, { css } from 'styled-components';
|
|
3
|
-
|
|
4
|
-
import { theme } from '../design_system/theme.js';
|
|
5
|
-
import type { Size } from '../design_system/tokens/index.js';
|
|
6
|
-
import type { WithTransientProps } from '../type_utils.js';
|
|
7
|
-
|
|
8
|
-
type ExtendedSize = Size | 'none' | 'auto';
|
|
9
|
-
|
|
10
|
-
export interface MarginSpacingProps {
|
|
11
|
-
m?: ExtendedSize,
|
|
12
|
-
mt?: ExtendedSize,
|
|
13
|
-
mb?: ExtendedSize,
|
|
14
|
-
ml?: ExtendedSize,
|
|
15
|
-
mr?: ExtendedSize,
|
|
16
|
-
mx?: ExtendedSize,
|
|
17
|
-
my?: ExtendedSize,
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface PaddingSpacingProps {
|
|
21
|
-
p?: ExtendedSize,
|
|
22
|
-
pt?: ExtendedSize,
|
|
23
|
-
pb?: ExtendedSize,
|
|
24
|
-
pl?: ExtendedSize,
|
|
25
|
-
pr?: ExtendedSize,
|
|
26
|
-
px?: ExtendedSize,
|
|
27
|
-
py?: ExtendedSize,
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
type SharedBoxProps = {
|
|
31
|
-
children?: React.ReactNode,
|
|
32
|
-
className?: string,
|
|
33
|
-
style?: React.CSSProperties
|
|
34
|
-
onClick?: (e: React.MouseEvent) => void,
|
|
35
|
-
id?: string,
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// This should be renamed - these props are global for any element not just Boxes
|
|
39
|
-
export type RegularBoxProps = SharedBoxProps & { as?: React.ElementType };
|
|
40
|
-
|
|
41
|
-
type OlBoxProps = SharedBoxProps & { as: 'ol', start?: number };
|
|
42
|
-
|
|
43
|
-
/** Combines together RegularBoxProps and props for specific elements. */
|
|
44
|
-
type AnyBoxProps = RegularBoxProps | OlBoxProps;
|
|
45
|
-
|
|
46
|
-
export type BoxProps = MarginSpacingProps & PaddingSpacingProps & AnyBoxProps;
|
|
47
|
-
|
|
48
|
-
const getSizeValue = (token?: ExtendedSize) => {
|
|
49
|
-
if (!token || token === 'none') return 0;
|
|
50
|
-
if (token === 'auto') return 'auto';
|
|
51
|
-
return theme.space[token] || 0;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
const StyledBox = styled.div<WithTransientProps<MarginSpacingProps & PaddingSpacingProps>>`
|
|
55
|
-
${({ $mt, $my, $m }) => ($mt || $my || $m) && css`
|
|
56
|
-
margin-top: ${getSizeValue($mt || $my || $m)};
|
|
57
|
-
`}
|
|
58
|
-
|
|
59
|
-
${({ $mb, $my, $m }) => ($mb || $my || $m) && css`
|
|
60
|
-
margin-bottom: ${getSizeValue($mb || $my || $m)};
|
|
61
|
-
`}
|
|
62
|
-
|
|
63
|
-
${({ $mr, $mx, $m }) => ($mr || $mx || $m) && css`
|
|
64
|
-
margin-right: ${getSizeValue($mr || $mx || $m)};
|
|
65
|
-
`}
|
|
66
|
-
|
|
67
|
-
${({ $ml, $mx, $m }) => ($ml || $mx || $m) && css`
|
|
68
|
-
margin-left: ${getSizeValue($ml || $mx || $m)};
|
|
69
|
-
`}
|
|
70
|
-
|
|
71
|
-
${({ $pt, $py, $p }) => ($pt || $py || $p) && css`
|
|
72
|
-
padding-top: ${getSizeValue($pt || $py || $p)};
|
|
73
|
-
`}
|
|
74
|
-
|
|
75
|
-
${({ $pb, $py, $p }) => ($pb || $py || $p) && css`
|
|
76
|
-
padding-bottom: ${getSizeValue($pb || $py || $p)};
|
|
77
|
-
`}
|
|
78
|
-
|
|
79
|
-
${({ $pr, $px, $p }) => ($pr || $px || $p) && css`
|
|
80
|
-
padding-right: ${getSizeValue($pr || $px || $p)};
|
|
81
|
-
`}
|
|
82
|
-
|
|
83
|
-
${({ $pl, $px, $p }) => ($pl || $px || $p) && css`
|
|
84
|
-
padding-left: ${getSizeValue($pl || $px || $p)};
|
|
85
|
-
`}
|
|
86
|
-
`;
|
|
87
|
-
// This component should work as a base component for all low level components (Heading, Message, Card, ...) to make it easy to define spacing.
|
|
88
|
-
// Right now, it's quite common to define some sort of spacing on these components already using css. Card = styled.div`margin-bottom: theme.space.space8`
|
|
89
|
-
// We should get rid of it and define it using props for Box component Card = styled(Box).attrs({mb: 'space8'})
|
|
90
|
-
export const Box = forwardRef<HTMLElement, BoxProps>(({
|
|
91
|
-
m,
|
|
92
|
-
mt,
|
|
93
|
-
mb,
|
|
94
|
-
ml,
|
|
95
|
-
mr,
|
|
96
|
-
mx,
|
|
97
|
-
my,
|
|
98
|
-
p,
|
|
99
|
-
pt,
|
|
100
|
-
pb,
|
|
101
|
-
pl,
|
|
102
|
-
pr,
|
|
103
|
-
px,
|
|
104
|
-
py,
|
|
105
|
-
as,
|
|
106
|
-
...rest
|
|
107
|
-
}: BoxProps, ref) => (
|
|
108
|
-
<StyledBox
|
|
109
|
-
$m={m}
|
|
110
|
-
$mt={mt}
|
|
111
|
-
$mb={mb}
|
|
112
|
-
$ml={ml}
|
|
113
|
-
$mr={mr}
|
|
114
|
-
$mx={mx}
|
|
115
|
-
$my={my}
|
|
116
|
-
$p={p}
|
|
117
|
-
$pt={pt}
|
|
118
|
-
$pb={pb}
|
|
119
|
-
$pl={pl}
|
|
120
|
-
$pr={pr}
|
|
121
|
-
$px={px}
|
|
122
|
-
$py={py}
|
|
123
|
-
as={as}
|
|
124
|
-
ref={ref}
|
|
125
|
-
{...rest}
|
|
126
|
-
/>
|
|
127
|
-
));
|