Skip to content

Commit dfdd580

Browse files
authored
Editor style fixes (#426)
* fix: design review styles
1 parent c9697ee commit dfdd580

File tree

9 files changed

+72
-36
lines changed

9 files changed

+72
-36
lines changed

src/editor/components/AddBlock/AddBlock.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ $block: '.#{$ns}add-block';
1010
$buttonWidth: 76px;
1111
$buttonHeight: 40px;
1212

13-
position: fixed;
13+
position: absolute;
1414
bottom: $indentM;
1515
left: calc(50% + var(--editor-left-column-width) / 2);
1616
transform: translateX(-50%);
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
@import '../../../../styles/variables.scss';
2+
3+
$block: '.#{$ns}block-form';
4+
5+
#{$block}__folded {
6+
margin-bottom: 15px;
7+
}

src/editor/components/BlockForm/BlockForm.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1-
import React, {memo, useMemo} from 'react';
1+
import React, {Fragment, memo, useMemo} from 'react';
22

33
import {DynamicField, SimpleVerticalAccordeon, Spec} from '@gravity-ui/dynamic-forms';
44
import _ from 'lodash';
55
import {Form as FinalForm, FormSpy} from 'react-final-form';
66

77
import {Block} from '../../../models';
8+
import {block} from '../../../utils';
89
import {dynamicConfig} from '../../dynamic-forms-custom/config';
910
import {CustomSpec} from '../../dynamic-forms-custom/parser/types';
1011
import usePreviousValue from '../../hooks/usePreviousValue';
1112

13+
import './BlockForm.scss';
14+
1215
interface BlockFormProps {
1316
data: Block;
1417
spec: CustomSpec;
@@ -17,6 +20,8 @@ interface BlockFormProps {
1720
active?: boolean;
1821
}
1922

23+
const b = block('block-form');
24+
2025
export const BlockForm = memo(
2126
({data: {type, ...content}, onChange, onSelect, active, spec: specRaw}: BlockFormProps) => {
2227
const initialValues = useMemo(() => ({content}), [content]);
@@ -39,17 +44,17 @@ export const BlockForm = memo(
3944
name={type}
4045
title={spec.viewSpec.layoutTitle || type}
4146
onOpenChange={onSelect}
47+
className={b('folded')}
4248
>
43-
{/* SimpleVerticalAccordeon requires children, put dummy value*/}
44-
{1}
49+
{/* SimpleVerticalAccordeon requires children, put dummy value*/}{' '}
4550
</SimpleVerticalAccordeon>
4651
);
4752
}
4853

4954
return (
5055
<FinalForm initialValues={initialValues} onSubmit={_.noop}>
5156
{() => (
52-
<div>
57+
<Fragment>
5358
<FormSpy
5459
onChange={({values}) => {
5560
// fix for FormSpy onChange called twice without content changes
@@ -65,7 +70,7 @@ export const BlockForm = memo(
6570
config={dynamicConfig}
6671
withoutInsertFFDebounce
6772
/>
68-
</div>
73+
</Fragment>
6974
)}
7075
</FinalForm>
7176
);

src/editor/components/ControlPanel/ControlPanel.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ $block: '.#{$ns}control-panel';
1212
height: var(--editor-header-height);
1313
padding: $indentXXXS $indentS;
1414
background-color: var(--yc-color-base-background);
15-
border-bottom: 1px solid var(--yc-color-line-generic);
15+
border: 1px var(--yc-color-line-generic);
16+
border-style: solid none;
1617

1718
&__icon {
1819
display: flex;

src/editor/components/EditBlock/EditBlock.scss

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
$block: '.#{$ns}edit-block';
77

88
#{$block} {
9-
$controlIconHeight: 24px;
9+
$controlIconWidth: 48px;
10+
$controlIconHeight: 32px;
1011
$controlsIndent: $indentS;
1112
$controlColor: var(--yc-color-promo-base-neon);
1213

@@ -19,7 +20,7 @@ $block: '.#{$ns}edit-block';
1920
height: calc(100% + $controlsIndent * 2);
2021
top: -#{$controlsIndent};
2122
left: -#{$controlsIndent};
22-
border-radius: $editorControlBorderRadius;
23+
border-radius: $borderRadius;
2324
z-index: $editorBlockControlZIndex;
2425

2526
&_isHeader {
@@ -36,21 +37,21 @@ $block: '.#{$ns}edit-block';
3637
&__controls-content {
3738
display: flex;
3839
position: absolute;
39-
bottom: calc(($controlsIndent + $controlIconHeight) * -1);
40+
bottom: -40px;
4041
left: 50%;
4142
transform: translateX(-50%);
4243
}
4344

4445
&__control {
4546
@include control($hoverScale: 1.1);
4647

47-
width: $controlIconHeight;
48+
width: $controlIconWidth;
4849
height: $controlIconHeight;
49-
border-radius: calc(#{$editorControlBorderRadius} / 2);
50+
border-radius: $editorControlBorderRadius;
5051
background-color: var(--yc-color-promo-highlight-neon);
5152

5253
&:not(:first-child) {
53-
margin-left: $indentXXS;
54+
margin-left: 4px;
5455
}
5556
}
5657
}

src/editor/components/Layout/Layout.scss

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,17 @@ $block: '.#{$ns}editor-layout';
3636

3737
&__left {
3838
flex: 0 0 auto;
39-
padding: $indentXXXS $indentS $indentS;
39+
padding: $indentSM $indentXS;
4040
width: var(--editor-left-column-width);
4141
border-right: var(--editor-divider-width) solid var(--yc-color-line-generic);
4242
overflow-x: auto;
4343
}
4444

4545
&__right {
4646
width: 100%;
47+
48+
&_editing {
49+
padding-bottom: 200px;
50+
}
4751
}
4852
}

src/editor/components/Layout/Layout.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export interface LayoutProps {
1818

1919
const Layout = ({children, mode, onModeChange}: PropsWithChildren<LayoutProps>) => {
2020
let left, right;
21+
const isEditingMode = mode === ViewModeItem.Edititng;
2122

2223
function handleChild(child: ReactElement) {
2324
switch (child?.type) {
@@ -40,7 +41,7 @@ const Layout = ({children, mode, onModeChange}: PropsWithChildren<LayoutProps>)
4041
<div className={b('container')}>
4142
<Fragment>
4243
{left && <div className={b('left')}>{left}</div>}
43-
{right && <div className={b('right')}>{right}</div>}
44+
{right && <div className={b('right', {editing: isEditingMode})}>{right}</div>}
4445
</Fragment>
4546
</div>
4647
</div>

src/editor/containers/Form/dynamic-form-custom.scss

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
@mixin dynamic-form-custom {
44
--top-level-font-size: var(--yc-text-display-2-font-size);
55
--top-level-line-height: var(--yc-text-display-2-line-height);
6-
--block-propery-font-size: var(--yc-text-body-3-font-size);
7-
--block-property-line-height: var(--yc-text-body-3-line-height);
8-
--nested-property-font-size: var(--yc-text-body-1-font-size);
9-
--nested-property-line-height: var(--yc-text-body-1-line-height);
10-
--complex-nested-property-font-size: var(--yc-text-body-2-font-size);
11-
--complex-nested-property-line-height: var(--yc-text-body-2-line-height);
6+
--block-level-complex-propery-font-size: var(--yc-text-body-3-font-size);
7+
--block-level-complex-property-line-height: var(--yc-text-body-3-line-height);
8+
--complex-property-font-size: var(--yc-text-body-2-font-size);
9+
--complex-property-line-height: var(--yc-text-body-2-line-height);
10+
--property-font-size: var(--yc-text-body-1-font-size);
11+
--property-line-height: var(--yc-text-body-1-line-height);
1212

1313
--input-min-width: 150px;
14-
--property-title-width: 140px;
14+
--property-title-width: 96px;
1515

1616
// blocks list level definitons
1717
--button-height: 48px;
@@ -30,10 +30,11 @@
3030
--icon-size: 20px;
3131
--icon-margin: 30px;
3232

33-
--header-text-size: var(--block-propery-font-size);
34-
--header-line-height: var(--block-property-line-height);
35-
--text-size: var(--block-propery-font-size);
36-
--line-height: var(--block-property-line-height);
33+
--header-text-size: var(--block-level-complex-propery-font-size);
34+
--header-line-height: var(--block-level-complex-property-line-height);
35+
--text-size: var(--property-font-size);
36+
--line-height: var(--property-line-height);
37+
--property-font-weight: 400;
3738
}
3839

3940
// block nested properties level definitons
@@ -43,10 +44,13 @@
4344
--icon-margin: 25px;
4445
--property-font-weight: 400;
4546

46-
--header-text-size: var(--complex-nested-property-font-size);
47-
--header-line-height: var(--complex-nested-property-line-height);
48-
--text-size: var(--nested-property-font-size);
49-
--line-height: var(--nested-property-line-height);
47+
--header-text-size: var(--complex-property-font-size);
48+
--header-line-height: var(--complex-property-line-height);
49+
--text-size: var(--property-font-size);
50+
--line-height: var(--property-line-height);
51+
52+
--oneof-text-size: var(--complex-propery-font-size);
53+
--oneof-line-height: var(--complex-property-line-height);
5054
}
5155

5256
.df-row {
@@ -97,19 +101,32 @@
97101
}
98102
}
99103

104+
.df-simple-vertical-accordeon__body {
105+
margin-top: 0px;
106+
padding-top: $indentXXS;
107+
}
108+
109+
.df-use-search {
110+
margin: 4px 0;
111+
}
112+
100113
.df-simple-vertical-accordeon__body,
101114
.df-group-indent > .df-use-search {
102115
margin-top: 0;
103116
margin-left: 1px;
104-
105-
padding-top: $indentXXS;
106-
padding-left: $indentXS;
107-
117+
padding-top: 4px;
118+
padding-bottom: 4px;
119+
padding-left: $indentXXS;
108120
border-left: 1px solid var(--yc-color-line-generic-accent);
109121
}
110122

123+
.df-simple-vertical-accordeon_branch .df-simple-vertical-accordeon__body {
124+
padding-left: $indentXXS;
125+
}
126+
111127
.g-select,
112128
.yc-text-input {
113-
width: var(--input-min-width);
129+
min-width: var(--input-min-width);
130+
width: 100%;
114131
}
115132
}

src/editor/dynamic-forms-custom/components/OneOfCustom/OneOfCustom.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ $block: '.#{$ns}one-of-custom';
2121

2222
& > .#{$df-ns}use-search {
2323
padding-top: 11px;
24-
padding-left: $normalOffset;
24+
padding-left: $indentXXS;
2525
margin-top: 4px;
2626
margin-bottom: $normalOffset;
2727
margin-left: 5px;

0 commit comments

Comments
 (0)