Skip to content

Commit 02635ee

Browse files
committed
fix: card one of view layout
1 parent aa2963c commit 02635ee

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

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

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {Row} from '../../Layouts';
1515
import {RemoveButton} from '../../RemoveButton';
1616

1717
export const CardOneOf: ObjectIndependentInput = (props) => {
18-
const {input, meta, spec, name} = props;
18+
const {input, meta, spec, name, Layout} = props;
1919

2020
const [open, setOpen] = React.useState(true);
2121

@@ -27,14 +27,19 @@ export const CardOneOf: ObjectIndependentInput = (props) => {
2727
onTogglerChange: onOpen,
2828
});
2929

30-
const toggler = React.useMemo(
31-
() => (
32-
<Row {...props} name="__stub-name">
33-
{togglerInput}
34-
</Row>
35-
),
36-
[togglerInput, props],
37-
);
30+
const toggler = React.useMemo(() => {
31+
const togglerProps = {
32+
...props,
33+
name: '__stub-name',
34+
children: togglerInput,
35+
} as const;
36+
37+
if (Layout) {
38+
return <Layout {...togglerProps} />;
39+
}
40+
41+
return <Row {...togglerProps} />;
42+
}, [togglerInput, props]);
3843

3944
const actions = React.useMemo(() => {
4045
if (isArrayItem(name)) {

0 commit comments

Comments
 (0)