Skip to content

Commit 1b57ef6

Browse files
authored
feat: condensed design (#731)
1 parent 7c0140c commit 1b57ef6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+406
-248
lines changed

.changeset/healthy-emus-smash.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@cube-dev/ui-kit": minor
3+
---
4+
5+
More condensed UI. New sizes: medium (40) -> large (40), small (32) -> medium (32), large (48) -> xlarge (48), small (28), xsmall (24).

.changeset/ten-rabbits-heal.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@cube-dev/ui-kit": minor
3+
---
4+
5+
Add size prop for TextInputMapper.

.cursor/rules/coding.mdc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
alwaysApply: true
33
---
44

5-
# Flow rules
5+
# Development flow rules
66
- Don't respond with "You're right!", "Great idea!" and so on. Get straight to the point.
7-
- **Stop and describe the reason**, if you can't closely implement the task or need a different approach from what was asked.
7+
- **Stop and describe the reason**, if you can't closely implement the task, or need a different approach from what was asked, or noticed a critical mistake in the prompt.
88
- Do not run tests if you only changed stories or documentation since the last test run.
9+
- If you need to move or rename a file: use command line tools for that.
10+
- If you need to move a part of code from one file to another: First, write the code at the new place, then delete the code in the original place.
911

1012
# Coding rules
1113

.size-limit.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module.exports = [
2020
}),
2121
);
2222
},
23-
limit: '279kB',
23+
limit: '280kB',
2424
},
2525
{
2626
name: 'Tree shaking (just a Button)',

src/components/actions/Button/Button.docs.mdx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,11 @@ The `mods` prop accepts the following modifiers you can override:
7777

7878
### Sizes. `size` prop
7979

80-
- `small` – Compact height (4×).
81-
- `medium` – Default height (5×).
82-
- `large` – Spacious height (6×).
80+
- `xsmall` – Extra compact height (24px).
81+
- `small` – Compact height (28px).
82+
- `medium` – Default height (32px).
83+
- `large` – Spacious height (40px).
84+
- `xlarge` – Extra spacious height (48px).
8385

8486
## Examples
8587

src/components/actions/Button/Button.stories.tsx

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export default {
2929
},
3030
},
3131
size: {
32-
options: ['tiny', 'small', 'medium', 'large'],
32+
options: ['xsmall', 'small', 'medium', 'large', 'xlarge'],
3333
control: { type: 'radio' },
3434
description: 'Button size',
3535
table: {
@@ -115,15 +115,36 @@ const TemplateSizes: StoryFn<CubeButtonProps> = ({
115115
...props
116116
}) => (
117117
<Space>
118+
<Button icon={icon} rightIcon={rightIcon} {...props} size="xsmall">
119+
XSmall
120+
</Button>
118121
<Button icon={icon} rightIcon={rightIcon} {...props} size="small">
119-
{children}
122+
Small
120123
</Button>
121124
<Button icon={icon} rightIcon={rightIcon} {...props} size="medium">
122-
{children}
125+
Medium
123126
</Button>
124127
<Button icon={icon} rightIcon={rightIcon} {...props} size="large">
125-
{children}
128+
Large
126129
</Button>
130+
<Button icon={icon} rightIcon={rightIcon} {...props} size="xlarge">
131+
XLarge
132+
</Button>
133+
</Space>
134+
);
135+
136+
const TemplateSizesOnlyIcon: StoryFn<CubeButtonProps> = ({
137+
children,
138+
icon,
139+
rightIcon,
140+
...props
141+
}) => (
142+
<Space>
143+
<Button icon={icon} rightIcon={rightIcon} {...props} size="xsmall" />
144+
<Button icon={icon} rightIcon={rightIcon} {...props} size="small" />
145+
<Button icon={icon} rightIcon={rightIcon} {...props} size="medium" />
146+
<Button icon={icon} rightIcon={rightIcon} {...props} size="large" />
147+
<Button icon={icon} rightIcon={rightIcon} {...props} size="xlarge" />
127148
</Space>
128149
);
129150

@@ -477,7 +498,7 @@ TwoIconsAndText.args = {
477498
rightIcon: <IconCaretDown />,
478499
};
479500

480-
export const OnlyIcon = TemplateSizes.bind({});
501+
export const OnlyIcon = TemplateSizesOnlyIcon.bind({});
481502
OnlyIcon.args = {
482503
icon: <IconCoin />,
483504
};

src/components/actions/Button/Button.tsx

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export interface CubeButtonProps extends CubeActionProps {
2727
| 'outline'
2828
| 'neutral'
2929
| (string & {});
30-
size?: 'tiny' | 'small' | 'medium' | 'large' | (string & {});
30+
size?: 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | (string & {});
3131
}
3232

3333
export type ButtonVariant =
@@ -76,34 +76,38 @@ export const DEFAULT_BUTTON_STYLES = {
7676
flow: 'column',
7777
preset: {
7878
'': 't3m',
79-
'[data-size="large"]': 't2m',
79+
'[data-size="xsmall"]': 't4',
80+
'[data-size="xlarge"]': 't2m',
8081
},
8182
textDecoration: 'none',
8283
transition: 'theme',
8384
reset: 'button',
8485
outlineOffset: 1,
8586
padding: {
86-
'': '.5x (2x - 1bw)',
87-
'[data-size="tiny"]': '.5x (1x - 1bw)',
88-
'[data-size="small"]': '.5x (1x - 1bw)',
87+
'': '.5x (1.5x - 1bw)',
88+
'[data-size="small"] | [data-size="xsmall"]': '.5x (1x - 1bw)',
8989
'[data-size="medium"]': '.5x (1.5x - 1bw)',
90-
'[data-size="large"]': '.5x (2.25x - 1bw)',
90+
'[data-size="large"]': '.5x (2x - 1bw)',
91+
'[data-size="xlarge"]': '.5x (2.25x - 1bw)',
9192
'single-icon-only | [data-type="link"]': 0,
9293
},
9394
width: {
9495
'': 'initial',
95-
'[data-size="tiny"] & single-icon-only': '3.5x 3.5x',
96-
'[data-size="small"] & single-icon-only': '4x 4x',
97-
'[data-size="medium"] & single-icon-only': '5x 5x',
98-
'[data-size="large"] & single-icon-only': '6x 6x',
96+
'[data-size="xsmall"] & single-icon-only': '@size-xs @size-xs',
97+
'[data-size="small"] & single-icon-only': '@size-sm @size-sm',
98+
'[data-size="medium"] & single-icon-only': '@size-md @size-md',
99+
'[data-size="large"] & single-icon-only': '@size-lg @size-lg',
100+
'[data-size="xlarge"] & single-icon-only': '@size-xl @size-xl',
101+
'[data-type="link"]': 'initial',
99102
},
100103
height: {
101104
'': 'initial',
102-
'[data-size="tiny"]': '3.5x 3.5x',
103-
'[data-size="small"]': '4x 4x',
104-
'[data-size="medium"]': '5x 5x',
105-
'[data-size="large"]': '6x 6x',
106-
'[data-type="link"]': 'auto',
105+
'[data-size="xsmall"]': '@size-xs @size-xs',
106+
'[data-size="small"]': '@size-sm @size-sm',
107+
'[data-size="medium"]': '@size-md @size-md',
108+
'[data-size="large"]': '@size-lg @size-lg',
109+
'[data-size="xlarge"]': '@size-xl @size-xl',
110+
'[data-type="link"]': 'initial',
107111
},
108112
whiteSpace: 'nowrap',
109113
radius: {

0 commit comments

Comments
 (0)