Skip to content

Commit

Permalink
feat(4221): use different view for disabled multi-select
Browse files Browse the repository at this point in the history
  • Loading branch information
junminahn committed Nov 12, 2024
1 parent 1a341a0 commit 2a70608
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions app/components/generic/select/FormMultiSelect.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import { MultiSelect, ComboboxData } from '@mantine/core';
import { MultiSelect, ComboboxData, InputBase, Pill } from '@mantine/core';
import _kebabCase from 'lodash-es/kebabCase';
import { FocusEventHandler } from 'react';
import { cn } from '@/utils';
Expand Down Expand Up @@ -43,17 +43,27 @@ export default function FormMultiSelect({
</Label>
)}

<MultiSelect
placeholder="select..."
data={data}
onChange={onChange}
onBlur={onBlur}
value={value}
searchable
clearable
disabled={disabled}
classNames={{ input: cn('text-md', classNames?.input) }}
/>
{disabled ? (
<InputBase component="div" multiline>
<Pill.Group>
{value.map((item) => (
<Pill key={item}>{item}</Pill>
))}
</Pill.Group>
</InputBase>
) : (
<MultiSelect
placeholder="select..."
data={data}
onChange={onChange}
onBlur={onBlur}
value={value}
searchable
clearable
disabled={disabled}
classNames={{ input: cn('text-md', classNames?.input) }}
/>
)}
</div>
);
}

0 comments on commit 2a70608

Please sign in to comment.