Streamfield: don't render values container unless it has values
This commit is contained in:
parent
9abe924e92
commit
b401af2950
1 changed files with 18 additions and 16 deletions
|
@ -65,22 +65,24 @@ const Streamfield: React.FC<IStreamfield> = ({
|
||||||
{hint && <Text size='xs' theme='muted'>{hint}</Text>}
|
{hint && <Text size='xs' theme='muted'>{hint}</Text>}
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
||||||
<Stack>
|
{(values.length > 0) && (
|
||||||
{values.map((value, i) => (
|
<Stack>
|
||||||
<HStack space={2} alignItems='center'>
|
{values.map((value, i) => (
|
||||||
<Component key={i} onChange={handleChange(i)} value={value} />
|
<HStack space={2} alignItems='center'>
|
||||||
{onRemoveItem && (
|
<Component key={i} onChange={handleChange(i)} value={value} />
|
||||||
<IconButton
|
{onRemoveItem && (
|
||||||
iconClassName='w-4 h-4'
|
<IconButton
|
||||||
className='bg-transparent text-gray-400 hover:text-gray-600'
|
iconClassName='w-4 h-4'
|
||||||
src={require('@tabler/icons/icons/x.svg')}
|
className='bg-transparent text-gray-400 hover:text-gray-600'
|
||||||
onClick={() => onRemoveItem(i)}
|
src={require('@tabler/icons/icons/x.svg')}
|
||||||
title={intl.formatMessage(messages.remove)}
|
onClick={() => onRemoveItem(i)}
|
||||||
/>
|
title={intl.formatMessage(messages.remove)}
|
||||||
)}
|
/>
|
||||||
</HStack>
|
)}
|
||||||
))}
|
</HStack>
|
||||||
</Stack>
|
))}
|
||||||
|
</Stack>
|
||||||
|
)}
|
||||||
|
|
||||||
{onAddItem && (
|
{onAddItem && (
|
||||||
<Button
|
<Button
|
||||||
|
|
Loading…
Reference in a new issue