fix: 💄 update style of multi select component
This commit is contained in:
parent
0ea8b91211
commit
15072d4527
9 changed files with 644 additions and 312 deletions
|
|
@ -177,9 +177,11 @@ return [
|
|||
],
|
||||
],
|
||||
"multi_select" => [
|
||||
"search_options" => "search options...",
|
||||
"search_options" => "search among the options...",
|
||||
"select_all" => "select all",
|
||||
"more" => "more",
|
||||
"close_popover" => "close popover",
|
||||
"clear_list" => "deselect all items",
|
||||
],
|
||||
"simple_date_picker" => [
|
||||
"reset" => "reset the date"
|
||||
|
|
|
|||
|
|
@ -181,6 +181,8 @@ return [
|
|||
"search_options" => "cherchez parmi les options...",
|
||||
"select_all" => "tout sélectionner",
|
||||
"more" => "supplémentaire(s)",
|
||||
"close_popover" => "fermer la popup",
|
||||
"clear_list" => "désélectionner tous les éléments",
|
||||
],
|
||||
"simple_date_picker" => [
|
||||
"reset" => "vider la date",
|
||||
|
|
|
|||
|
|
@ -51,6 +51,17 @@ const MultiSelectRelationFilter = (props: Props) => {
|
|||
}}
|
||||
defaultValue={valuesFromUrl}
|
||||
options={options}
|
||||
responsive={{
|
||||
mobile: {
|
||||
maxCount: 3,
|
||||
},
|
||||
tablet: {
|
||||
maxCount: 4,
|
||||
},
|
||||
desktop: {
|
||||
maxCount: 5,
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ export default function EnumSelect({
|
|||
aria-expanded={open}
|
||||
disabled={disabled}
|
||||
className={cn(
|
||||
"w-full h-auto max-h-10 justify-between whitespace-normal text-start",
|
||||
"w-full h-10 justify-between whitespace-normal text-start",
|
||||
{ "text-muted-foreground": !selectedEnum },
|
||||
{ "border-destructive/50": localErrors[name] },
|
||||
)}
|
||||
|
|
@ -177,7 +177,7 @@ export default function EnumSelect({
|
|||
{Object.values(currentOptions).length === 0 && (
|
||||
<p className="text-sm text-muted-foreground text-center py-5">{useTrans("back.table_no_results")}</p>
|
||||
)}
|
||||
<div className="flex flex-col justify-between gap-1">
|
||||
<div className="flex flex-col justify-between">
|
||||
{Object.values(currentOptions).map((option) => (
|
||||
<Button
|
||||
key={option.value}
|
||||
|
|
|
|||
|
|
@ -330,20 +330,18 @@ export default function ModelSelect({
|
|||
</div>
|
||||
<div
|
||||
className="overflow-auto border-t flex flex-col justify-between p-1 gap-1"
|
||||
style={{ minHeight: options.length > 0 && lastPage !== 1 ? '265px' : '225px' }}
|
||||
style={{ minHeight: options.length > 0 && lastPage !== 1 ? '250px' : '200px' }}
|
||||
>
|
||||
{!loading && options.length === 0 && (
|
||||
<p className="text-sm text-muted-foreground text-center py-5">{useTrans("back.table_no_results")}</p>
|
||||
)}
|
||||
{loading ? (
|
||||
<>
|
||||
{[...Array(pageSize)].map(() => (
|
||||
<Skeleton className="h-10" />
|
||||
))}
|
||||
</>
|
||||
) : (
|
||||
<div className="flex flex-col justify-between gap-1">
|
||||
{options.map((option) => (
|
||||
<div className="flex flex-col justify-between">
|
||||
{loading ? (
|
||||
[...Array(pageSize)].map(() => (
|
||||
<Skeleton className="h-9 mb-1" />
|
||||
))
|
||||
) : (
|
||||
options.map((option) => (
|
||||
<Button
|
||||
key={option.id}
|
||||
className="w-full h-auto min-h-10 justify-between whitespace-normal text-start"
|
||||
|
|
@ -354,9 +352,9 @@ export default function ModelSelect({
|
|||
<span>{getModelField(option)}</span>
|
||||
{selectedId === option.id && <CheckIcon />}
|
||||
</Button>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
))
|
||||
)}
|
||||
</div>
|
||||
{/* Pagination boutons */}
|
||||
{options.length > 0 && lastPage !== 1 && (
|
||||
<div className="flex flex-col xl:flex-row justify-center items-center gap-1.5">
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -31,7 +31,6 @@ export default function Filters() {
|
|||
modelName={modelName}
|
||||
label={str(useTrans('back.model_filters.has_no_link.label')).ucFirst().value()}
|
||||
/>
|
||||
|
||||
<MultiSelectRelationFilter
|
||||
fieldName="categories"
|
||||
modelName={modelName}
|
||||
|
|
@ -41,7 +40,6 @@ export default function Filters() {
|
|||
modelTranslatable={true}
|
||||
optionName="name"
|
||||
/>
|
||||
|
||||
<MultiSelectRelationFilter
|
||||
fieldName="tags"
|
||||
modelName={modelName}
|
||||
|
|
|
|||
|
|
@ -313,6 +313,17 @@ export default function Form({
|
|||
setData={setData}
|
||||
defaultValue={defaultValue}
|
||||
options={options}
|
||||
responsive={{
|
||||
mobile: {
|
||||
maxCount: 3,
|
||||
},
|
||||
tablet: {
|
||||
maxCount: 4,
|
||||
},
|
||||
desktop: {
|
||||
maxCount: 5,
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<MultiSelect
|
||||
label={str(
|
||||
|
|
@ -341,6 +352,17 @@ export default function Form({
|
|||
setData={setData}
|
||||
defaultValue={categoryDefaultValue}
|
||||
options={categoriesOptions}
|
||||
responsive={{
|
||||
mobile: {
|
||||
maxCount: 3,
|
||||
},
|
||||
tablet: {
|
||||
maxCount: 4,
|
||||
},
|
||||
desktop: {
|
||||
maxCount: 5,
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<EnumSelect
|
||||
name="exercice"
|
||||
|
|
|
|||
|
|
@ -479,10 +479,21 @@ export default function Form({
|
|||
placeholder={str(useTrans("back.news.tags.placeholder"))
|
||||
.ucFirst()
|
||||
.value()}
|
||||
singleLine={true}
|
||||
singleLine={false}
|
||||
setData={setData}
|
||||
defaultValue={data.tags}
|
||||
options={optionTags}
|
||||
responsive={{
|
||||
mobile: {
|
||||
maxCount: 3,
|
||||
},
|
||||
tablet: {
|
||||
maxCount: 4,
|
||||
},
|
||||
desktop: {
|
||||
maxCount: 5,
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<MultiSelect
|
||||
label={str(
|
||||
|
|
@ -507,10 +518,21 @@ export default function Form({
|
|||
)
|
||||
.ucFirst()
|
||||
.value()}
|
||||
singleLine={true}
|
||||
singleLine={false}
|
||||
setData={setData}
|
||||
defaultValue={data.categories}
|
||||
options={optionCategories}
|
||||
responsive={{
|
||||
mobile: {
|
||||
maxCount: 3,
|
||||
},
|
||||
tablet: {
|
||||
maxCount: 4,
|
||||
},
|
||||
desktop: {
|
||||
maxCount: 5,
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</FieldsetWrapper>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue