Skip to content

Commit

Permalink
feat(components): Table colWidths enforces width
Browse files Browse the repository at this point in the history
  • Loading branch information
Lemonexe committed Oct 3, 2024
1 parent fedf275 commit 1dccfc1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions packages/components/src/components/Table/Table.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,20 @@ export const Table: StoryObj = {
),
args: {
...getFramePropsStory(allowedTableFrameProps).args,
colWidths: 'none',
},
argTypes: {
...getFramePropsStory(allowedTableFrameProps).argTypes,
colWidths: {
options: ['none', 'fixed'],
mapping: { none: undefined, fixed: ['150px', '400px'] },
control: {
type: 'select',
labels: {
none: 'undefined',
fixed: "fixed = ['150px', '400px']",
},
},
},
},
};
2 changes: 1 addition & 1 deletion packages/components/src/components/Table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const Table = ({ children, margin, colWidths }: TableProps) => {
{colWidths && (
<colgroup>
{colWidths.map((width, index) => (
<col key={index} style={{ width }} />
<col key={index} style={{ minWidth: width, maxWidth: width }} />
))}
</colgroup>
)}
Expand Down

0 comments on commit 1dccfc1

Please sign in to comment.