Skip to content

Commit 82cd266

Browse files
authored
Add the basis prop for flex-basis style to Layout components (#2495)
<!-- How to write a good PR title: - Follow [the Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/). - Give as much context as necessary and as little as possible - Prefix it with [WIP] while it’s a work in progress --> ## Self Checklist - [x] I wrote a PR title in **English** and added an appropriate **label** to the PR. - [x] I wrote the commit message in **English** and to follow [**the Conventional Commits specification**](https://www.conventionalcommits.org/en/v1.0.0/). - [x] I [added the **changeset**](https://github.com/changesets/changesets/blob/main/docs/adding-a-changeset.md) about the changes that needed to be released. (or didn't have to) - [x] I wrote or updated **documentation** related to the changes. (or didn't have to) - [x] I wrote or updated **tests** related to the changes. (or didn't have to) - [x] I tested the changes in various browsers. (or didn't have to) - Windows: Chrome, Edge, (Optional) Firefox - macOS: Chrome, Edge, Safari, (Optional) Firefox ## Related Issue <!-- Please link to issue if one exists --> - Fixes #2457 ## Summary <!-- Please brief explanation of the changes made --> 레이아웃 컴포넌트에 `basis` prop 추가 ## Details <!-- Please elaborate description of the changes --> - `flex-basis` 를 지원하는 `basis` prop을 추가합니다. - 기존 `grow`, `shrink` 와 동일하게 `flex-` prefix를 제거하는 방식으로 네이밍했습니다. ### Breaking change? (Yes/No) <!-- If Yes, please describe the impact and migration path for users --> No ## References <!-- Please list any other resources or points the reviewer should be aware of -->
1 parent ea1a6b1 commit 82cd266

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

.changeset/large-mails-count.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@channel.io/bezier-react': minor
3+
---
4+
5+
Layout components support the `basis` (`flex-basis`) property.

packages/bezier-react/src/styles/components/layout.module.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
--b-right: var(--b-inset);
1818
--b-bottom: var(--b-inset);
1919
--b-left: var(--b-inset);
20+
--b-basis: initial;
2021
--b-shrink: initial;
2122
--b-grow: initial;
2223
--b-background-color: initial;
@@ -29,8 +30,11 @@
2930

3031
inset: var(--b-top) var(--b-right) var(--b-bottom) var(--b-left);
3132

33+
/* stylelint-disable declaration-block-no-redundant-longhand-properties */
34+
flex-basis: var(--b-basis);
3235
flex-grow: var(--b-grow);
3336
flex-shrink: var(--b-shrink);
37+
/* stylelint-enable declaration-block-no-redundant-longhand-properties */
3438

3539
box-sizing: border-box;
3640
width: var(--b-width);

packages/bezier-react/src/types/props-helpers.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export const splitByLayoutProps = <Props extends LayoutProps>({
6060
right,
6161
bottom,
6262
left,
63+
basis,
6364
shrink,
6465
grow,
6566
backgroundColor,
@@ -97,6 +98,7 @@ export const splitByLayoutProps = <Props extends LayoutProps>({
9798
right,
9899
bottom,
99100
left,
101+
basis,
100102
shrink,
101103
grow,
102104
backgroundColor,
@@ -169,6 +171,7 @@ export const getLayoutStyles = ({
169171
right,
170172
bottom,
171173
left,
174+
basis,
172175
shrink,
173176
grow,
174177
backgroundColor,
@@ -204,6 +207,7 @@ export const getLayoutStyles = ({
204207
'--b-right': cssDimension(right),
205208
'--b-bottom': cssDimension(bottom),
206209
'--b-left': cssDimension(left),
210+
'--b-basis': cssDimension(basis),
207211
'--b-shrink': shrink,
208212
'--b-grow': grow,
209213
'--b-background-color': tokenCssVar(backgroundColor),

packages/bezier-react/src/types/props.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,12 +342,17 @@ export interface LayoutProps {
342342
*/
343343
left?: React.CSSProperties['left']
344344
/**
345-
* the flex-shrink factor of a flex item.
345+
* the flex-basis value of a flex item.
346+
* @default initial
347+
*/
348+
basis?: React.CSSProperties['flexBasis']
349+
/**
350+
* the flex-shrink value of a flex item.
346351
* @default initial
347352
*/
348353
shrink?: React.CSSProperties['flexShrink']
349354
/**
350-
* the flex-grow factor of a flex item.
355+
* the flex-grow value of a flex item.
351356
* @default initial
352357
*/
353358
grow?: React.CSSProperties['flexGrow']

0 commit comments

Comments
 (0)