Skip to content

Commit 3fc6da7

Browse files
authored
fix: editor form style indent (#428)
1 parent 18032e3 commit 3fc6da7

File tree

4 files changed

+23
-30
lines changed

4 files changed

+23
-30
lines changed

src/editor/components/BlockForm/BlockForm.scss

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/editor/components/BlockForm/BlockForm.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,10 @@ import _ from 'lodash';
55
import {Form as FinalForm, FormSpy} from 'react-final-form';
66

77
import {Block} from '../../../models';
8-
import {block} from '../../../utils';
98
import {dynamicConfig} from '../../dynamic-forms-custom/config';
109
import {CustomSpec} from '../../dynamic-forms-custom/parser/types';
1110
import usePreviousValue from '../../hooks/usePreviousValue';
1211

13-
import './BlockForm.scss';
14-
1512
interface BlockFormProps {
1613
data: Block;
1714
spec: CustomSpec;
@@ -20,8 +17,6 @@ interface BlockFormProps {
2017
active?: boolean;
2118
}
2219

23-
const b = block('block-form');
24-
2520
export const BlockForm = memo(
2621
({data: {type, ...content}, onChange, onSelect, active, spec: specRaw}: BlockFormProps) => {
2722
const initialValues = useMemo(() => ({content}), [content]);
@@ -44,7 +39,6 @@ export const BlockForm = memo(
4439
name={type}
4540
title={spec.viewSpec.layoutTitle || type}
4641
onOpenChange={onSelect}
47-
className={b('folded')}
4842
>
4943
{/* SimpleVerticalAccordeon requires children, put dummy value*/}{' '}
5044
</SimpleVerticalAccordeon>

src/editor/containers/Form/Form.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,8 @@ $block: '.#{$ns}editor-form';
1515
--yc-color-base-special: var(--yc-color-promo-base-neon);
1616
margin-bottom: $indentS;
1717
}
18+
19+
&__block-form {
20+
margin-bottom: $indentXS;
21+
}
1822
}

src/editor/containers/Form/Form.tsx

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -59,23 +59,25 @@ export const Form = memo(({content, onChange, activeBlockIndex, onSelect, spec}:
5959
<Fragment>
6060
{blocks.map((blockData, index) =>
6161
blocksSpec[blockData.type] ? (
62-
<BlockForm
63-
spec={blocksSpec[blockData.type]}
64-
key={getBlockKey(blockData, index)}
65-
data={blockData}
66-
active={activeBlockIndex === index}
67-
onChange={(data: Block) => {
68-
onChange({
69-
...content,
70-
blocks: [
71-
...blocks.slice(0, index),
72-
data,
73-
...blocks.slice(index + 1),
74-
],
75-
});
76-
}}
77-
onSelect={() => onSelect(index)}
78-
/>
62+
<div className={b('block-form')}>
63+
<BlockForm
64+
spec={blocksSpec[blockData.type]}
65+
key={getBlockKey(blockData, index)}
66+
data={blockData}
67+
active={activeBlockIndex === index}
68+
onChange={(data: Block) => {
69+
onChange({
70+
...content,
71+
blocks: [
72+
...blocks.slice(0, index),
73+
data,
74+
...blocks.slice(index + 1),
75+
],
76+
});
77+
}}
78+
onSelect={() => onSelect(index)}
79+
/>
80+
</div>
7981
) : null,
8082
)}
8183
</Fragment>

0 commit comments

Comments
 (0)