Skip to content

Commit a14183f

Browse files
authored
chore(@kadena/react-ui): Add overflow as a prop to layout components
2 parents 6d83714 + ee107ce commit a14183f

File tree

7 files changed

+44
-4
lines changed

7 files changed

+44
-4
lines changed

.changeset/five-rockets-beg.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@kadena/react-ui': patch
3+
---
4+
5+
Added overflow prop to the Box, Stack, and Grid components

packages/libs/react-ui/src/components/Layout/Box/Box.stories.tsx

+14-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Box } from '@components/Layout/Box';
33
import type { Meta, StoryObj } from '@storybook/react';
44
import { vars } from '@theme/vars.css';
55
import React from 'react';
6-
import { containerClass, itemClass } from '../stories.css';
6+
import { componentClass, containerClass, itemClass } from '../stories.css';
77

88
const spaceOptions: (keyof typeof vars.sizes | undefined)[] = [
99
undefined,
@@ -17,6 +17,7 @@ const dimensionOptions: string[] = ['100%', 'min-content', 'max-content'];
1717

1818
const meta: Meta<IBoxProps> = {
1919
title: 'Layout/Box',
20+
component: Box,
2021
parameters: {
2122
docs: {
2223
description: {
@@ -27,6 +28,13 @@ const meta: Meta<IBoxProps> = {
2728
},
2829
},
2930
argTypes: {
31+
overflow: {
32+
options: ['hidden', 'visible', 'scroll', 'auto'],
33+
control: {
34+
type: 'select',
35+
},
36+
description: 'Overflow css property.',
37+
},
3038
width: {
3139
options: [...spaceOptions, ...dimensionOptions, ...contentWidthOptions],
3240
control: {
@@ -218,7 +226,7 @@ export const Primary: Story = {
218226
marginBottom,
219227
marginLeft,
220228
marginRight,
221-
padding = '$6',
229+
padding,
222230
paddingX,
223231
paddingY,
224232
paddingTop,
@@ -231,6 +239,7 @@ export const Primary: Story = {
231239
height,
232240
minHeight,
233241
maxHeight,
242+
overflow,
234243
}) => (
235244
<div className={containerClass}>
236245
<Box
@@ -254,9 +263,10 @@ export const Primary: Story = {
254263
height={height}
255264
minHeight={minHeight}
256265
maxHeight={maxHeight}
257-
className={itemClass}
266+
overflow={overflow}
267+
className={componentClass}
258268
>
259-
Box Content
269+
<div className={itemClass}>Box Content</div>
260270
</Box>
261271
</div>
262272
),

packages/libs/react-ui/src/components/Layout/Box/Box.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export interface IBoxProps
2222
| 'maxWidth'
2323
| 'minHeight'
2424
| 'minWidth'
25+
| 'overflow'
2526
| 'padding'
2627
| 'paddingBottom'
2728
| 'paddingLeft'
@@ -54,6 +55,7 @@ export const Box = ({
5455
maxWidth,
5556
minHeight,
5657
minWidth,
58+
overflow,
5759
padding,
5860
paddingBottom,
5961
paddingLeft,
@@ -81,6 +83,7 @@ export const Box = ({
8183
maxWidth,
8284
minHeight,
8385
minWidth,
86+
overflow,
8487
padding,
8588
paddingBottom,
8689
paddingLeft,

packages/libs/react-ui/src/components/Layout/Grid/Grid.stories.tsx

+8
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ const meta: Meta<StoryType> = {
3535
},
3636
component: Grid.Root,
3737
argTypes: {
38+
overflow: {
39+
options: ['hidden', 'visible', 'scroll', 'auto'],
40+
control: {
41+
type: 'select',
42+
},
43+
description: 'Overflow css property.',
44+
},
3845
gap: {
3946
options: Object.keys(gapVariants) as (keyof typeof gapVariants)[],
4047
control: { type: 'select' },
@@ -249,6 +256,7 @@ const defaultArgs: Record<string, string | undefined> = {
249256
paddingBottom: undefined,
250257
paddingLeft: undefined,
251258
paddingRight: undefined,
259+
overflow: undefined,
252260
};
253261

254262
export const GridRoot: Story = {

packages/libs/react-ui/src/components/Layout/Grid/GridRoot.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export interface IGridRootProps
2525
| 'maxWidth'
2626
| 'minHeight'
2727
| 'minWidth'
28+
| 'overflow'
2829
| 'padding'
2930
| 'paddingBottom'
3031
| 'paddingLeft'
@@ -71,6 +72,7 @@ export const GridRoot: FC<IGridRootProps> = ({
7172
maxWidth,
7273
minHeight,
7374
minWidth,
75+
overflow,
7476
padding,
7577
paddingBottom,
7678
paddingLeft,
@@ -97,6 +99,7 @@ export const GridRoot: FC<IGridRootProps> = ({
9799
maxWidth,
98100
minHeight,
99101
minWidth,
102+
overflow,
100103
padding,
101104
paddingBottom,
102105
paddingLeft,

packages/libs/react-ui/src/components/Layout/Stack/Stack.stories.tsx

+8
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ const meta: Meta<typeof Stack> = {
3131
},
3232
},
3333
argTypes: {
34+
overflow: {
35+
options: ['hidden', 'visible', 'scroll', 'auto'],
36+
control: {
37+
type: 'select',
38+
},
39+
description: 'Overflow css property',
40+
},
3441
width: {
3542
options: [...spaceOptions, ...dimensionOptions, ...contentWidthOptions],
3643
control: {
@@ -263,6 +270,7 @@ const defaultArgs: Record<keyof typeof Stack, string | undefined> = {
263270
paddingBottom: undefined,
264271
paddingLeft: undefined,
265272
paddingRight: undefined,
273+
overflow: undefined,
266274
};
267275

268276
export const Horizontal: Story = {

packages/libs/react-ui/src/components/Layout/Stack/Stack.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export interface IStackProps
2323
| 'maxWidth'
2424
| 'minHeight'
2525
| 'minWidth'
26+
| 'overflow'
2627
| 'padding'
2728
| 'paddingBottom'
2829
| 'paddingLeft'
@@ -59,6 +60,7 @@ export const Stack = ({
5960
maxWidth,
6061
minHeight,
6162
minWidth,
63+
overflow,
6264
padding,
6365
paddingBottom,
6466
paddingLeft,
@@ -92,6 +94,7 @@ export const Stack = ({
9294
maxWidth,
9395
minHeight,
9496
minWidth,
97+
overflow,
9598
padding,
9699
paddingBottom,
97100
paddingLeft,

0 commit comments

Comments
 (0)