Skip to content

Commit a8b76ed

Browse files
authored
fix(stylesTransperantAndArrayBaseView): fixed styles (#113)
1 parent 71bae6c commit a8b76ed

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

src/lib/kit/components/Inputs/ArrayBase/ArrayBase.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@
1010
&_add-button-down {
1111
margin-bottom: 15px;
1212
}
13+
14+
&_items-primitive {
15+
min-width: 100%;
16+
17+
&:empty {
18+
min-width: unset;
19+
}
20+
}
1321
}
1422

1523
&__item-prefix {

src/lib/kit/components/Inputs/ArrayBase/ArrayBase.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ import {
1414
OBJECT_ARRAY_FLAG,
1515
Spec,
1616
ValidateError,
17+
isBooleanSpec,
1718
isCorrectSpec,
19+
isNumberSpec,
20+
isStringSpec,
1821
transformArrIn,
1922
} from '../../../../core';
2023
import {block} from '../../../utils';
@@ -35,6 +38,10 @@ export const ArrayBase: ArrayInput = ({spec, name, arrayInput, input}) => {
3538

3639
const itemSpecCorrect = React.useMemo(() => isCorrectSpec(spec.items), [spec.items]);
3740

41+
const itemsPrimitive = React.useMemo(() => {
42+
return isBooleanSpec(spec.items) || isNumberSpec(spec.items) || isStringSpec(spec.items);
43+
}, [spec.items]);
44+
3845
const getItemSpec = React.useCallback(
3946
(idx: number): typeof spec.items | null => {
4047
if (!itemSpecCorrect) {
@@ -155,6 +162,7 @@ export const ArrayBase: ArrayInput = ({spec, name, arrayInput, input}) => {
155162
className={b('items-wrapper', {
156163
'add-button-down':
157164
spec.viewSpec.addButtonPosition !== 'right' && keys.length > 0,
165+
'items-primitive': itemsPrimitive,
158166
})}
159167
>
160168
{items}

src/lib/kit/components/Views/ArrayBaseView/ArrayBaseView.scss

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
.#{$ns}array-base-view {
44
&__item-prefix {
5-
margin-top: -10px;
6-
margin-bottom: 15px;
5+
margin-bottom: 6px;
76
}
87
}

0 commit comments

Comments
 (0)