Skip to content

Commit

Permalink
fix label width of selectlist in stories
Browse files Browse the repository at this point in the history
  • Loading branch information
sebald committed Oct 7, 2024
1 parent 20e67fc commit b8ed587
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
12 changes: 9 additions & 3 deletions docs/content/components/collection/selectlist/selectlist.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,18 @@ import { SelectList } from '@marigold/components';

This example shows the standard appearance for `SelectList` component.

<ComponentDemo file="./selectlist-basic.demo.tsx" />
<ComponentDemo disableLabelWidth file="./selectlist-basic.demo.tsx" />

### SelectList with single selection mode

<ComponentDemo file="./selectlist-single-selection.demo.tsx" />
<ComponentDemo
disableLabelWidth
file="./selectlist-single-selection.demo.tsx"
/>

### SelectList with multiple selection mode

<ComponentDemo file="./selectlist-multiple-selection.demo.tsx" />
<ComponentDemo
disableLabelWidth
file="./selectlist-multiple-selection.demo.tsx"
/>
3 changes: 3 additions & 0 deletions packages/components/src/SelectList/SelectList.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import { SelectList } from './SelectList';

const meta = {
title: 'Components/SelectList',
parameters: {
disableLabelWidth: true,
},
argTypes: {
selectionMode: {
control: {
Expand Down
8 changes: 2 additions & 6 deletions packages/components/src/SelectList/SelectListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,11 @@ const _SelectListItem = forwardRef<HTMLDivElement, SelectListItemProps>(
'items-center group-data-[layout=grid]/list:flex-row',
classNames?.option
)}
ref={ref as Ref<HTMLDivElement>}
ref={ref}
>
{({ selectionMode }) => (
<>
{selectionMode === 'multiple' && (
<FieldGroup>
<Checkbox slot="selection" />
</FieldGroup>
)}
{selectionMode === 'multiple' && <Checkbox slot="selection" />}
{children}
</>
)}
Expand Down

0 comments on commit b8ed587

Please sign in to comment.