mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-19 08:52:25 +01:00
(ui) add identation for the select sub categories options
This commit is contained in:
parent
1db8bd8537
commit
9f32784aec
@ -36,7 +36,7 @@ interface ProductFormProps {
|
||||
* Option format, expected by react-select
|
||||
* @see https://github.com/JedWatson/react-select
|
||||
*/
|
||||
type selectOption = { value: number, label: string };
|
||||
type selectOption = { value: number, label: string | JSX.Element };
|
||||
|
||||
/**
|
||||
* Option format, expected by checklist
|
||||
@ -69,9 +69,14 @@ export const ProductForm: React.FC<ProductFormProps> = ({ product, title, onSucc
|
||||
/**
|
||||
* Convert the provided array of items to the react-select format
|
||||
*/
|
||||
const buildSelectOptions = (items: Array<{ id?: number, name: string }>): Array<selectOption> => {
|
||||
const buildSelectOptions = (items: Array<{ id?: number, name: string, parent_id?: number }>): Array<selectOption> => {
|
||||
return items.map(t => {
|
||||
return { value: t.id, label: t.name };
|
||||
return {
|
||||
value: t.id,
|
||||
label: t.parent_id
|
||||
? <span className='u-leading-space'>{t.name}</span>
|
||||
: t.name
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -88,4 +88,9 @@
|
||||
background-color: #2d2d2d;
|
||||
border: 2px solid #d9d9d9
|
||||
}
|
||||
}
|
||||
|
||||
.u-leading-space {
|
||||
display: flex;
|
||||
padding-left: 2em;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user