Skip to content

Commit 7b6bf24

Browse files
author
Ivan Grekov
committed
fix styles
1 parent 300a01b commit 7b6bf24

File tree

2 files changed

+70
-52
lines changed

2 files changed

+70
-52
lines changed

src/ui/knobs/text/index.tsx

Lines changed: 68 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1-
import React from 'react';
2-
import styled from 'styled-components';
3-
import TextBox from '../../primitives/text-box';
4-
import RowPropertyPanel from '../../primitives/row-property-panel';
5-
import ColorPicker from '../../primitives/color-picker';
6-
import SingleSelect from '../../primitives/select';
7-
import ButtonGroup from '../../primitives/button-group';
8-
import { AlignLeft, AlignCenter, AlignRight, AlignJustify } from 'react-feather';
9-
import { Declarations, UpdateProp, RemoveProp } from '../../store';
1+
import React from "react";
2+
import styled from "styled-components";
3+
import TextBox from "../../primitives/text-box";
4+
import RowPropertyPanel from "../../primitives/row-property-panel";
5+
import ColorPicker from "../../primitives/color-picker";
6+
import SingleSelect from "../../primitives/select";
7+
import ButtonGroup from "../../primitives/button-group";
8+
import {
9+
AlignLeft,
10+
AlignCenter,
11+
AlignRight,
12+
AlignJustify
13+
} from "react-feather";
14+
import { Declarations, UpdateProp, RemoveProp } from "../../store";
1015

1116
const Container = styled.div``;
1217

@@ -17,15 +22,19 @@ interface Props {
1722
}
1823

1924
const Properties = {
20-
FontSize: 'font-size',
21-
LineHeight: 'line-height',
22-
FontWeight: 'font-weight',
23-
FontColor: 'color',
24-
FontFamily: 'font-family',
25-
TextAlign: 'text-align',
25+
FontSize: "font-size",
26+
LineHeight: "line-height",
27+
FontWeight: "font-weight",
28+
FontColor: "color",
29+
FontFamily: "font-family",
30+
TextAlign: "text-align"
2631
};
2732

28-
export default function TextStyles({ declarations, updateProp, removeProp }: Props) {
33+
export default function TextStyles({
34+
declarations,
35+
updateProp,
36+
removeProp
37+
}: Props) {
2938
return (
3039
<Container>
3140
<RowPropertyPanel
@@ -34,19 +43,25 @@ export default function TextStyles({ declarations, updateProp, removeProp }: Pro
3443
removeProp(Properties.FontSize);
3544
}}
3645
>
37-
<TextBox value={declarations[Properties.FontSize] || ''} onChange={value => updateProp(Properties.FontSize, value)} />
46+
<TextBox
47+
value={declarations[Properties.FontSize] || ""}
48+
onChange={value => updateProp(Properties.FontSize, value)}
49+
/>
3850
</RowPropertyPanel>
3951
<RowPropertyPanel
4052
label="Line height"
4153
onClear={() => {
4254
removeProp(Properties.LineHeight);
4355
}}
4456
>
45-
<TextBox value={declarations[Properties.LineHeight] || ''} onChange={value => updateProp(Properties.LineHeight, value)} />
57+
<TextBox
58+
value={declarations[Properties.LineHeight] || ""}
59+
onChange={value => updateProp(Properties.LineHeight, value)}
60+
/>
4661
</RowPropertyPanel>
4762
<RowPropertyPanel label="Font weight">
4863
<SingleSelect
49-
value={declarations[Properties.FontWeight] || ''}
64+
value={declarations[Properties.FontWeight] || ""}
5065
onChange={value => {
5166
if (value === null) {
5267
removeProp(Properties.FontWeight);
@@ -56,41 +71,41 @@ export default function TextStyles({ declarations, updateProp, removeProp }: Pro
5671
}}
5772
options={[
5873
{
59-
value: '100',
60-
label: '100',
74+
value: "100",
75+
label: "100"
6176
},
6277
{
63-
value: '200',
64-
label: '200',
78+
value: "200",
79+
label: "200"
6580
},
6681
{
67-
value: '300',
68-
label: '300',
82+
value: "300",
83+
label: "300"
6984
},
7085
{
71-
value: '400',
72-
label: '400',
86+
value: "400",
87+
label: "400"
7388
},
7489
{
75-
value: '500',
76-
label: '500',
90+
value: "500",
91+
label: "500"
7792
},
7893
{
79-
value: '600',
80-
label: '600',
94+
value: "600",
95+
label: "600"
8196
},
8297
{
83-
value: '700',
84-
label: '700',
98+
value: "700",
99+
label: "700"
85100
},
86101
{
87-
value: '800',
88-
label: '800',
102+
value: "800",
103+
label: "800"
89104
},
90105
{
91-
value: '900',
92-
label: '900',
93-
},
106+
value: "900",
107+
label: "900"
108+
}
94109
]}
95110
/>
96111
</RowPropertyPanel>
@@ -101,7 +116,7 @@ export default function TextStyles({ declarations, updateProp, removeProp }: Pro
101116
}}
102117
>
103118
<ColorPicker
104-
color={declarations[Properties.FontColor] || ''}
119+
color={declarations[Properties.FontColor] || ""}
105120
onChange={color => {
106121
updateProp(Properties.FontColor, color);
107122
}}
@@ -113,7 +128,10 @@ export default function TextStyles({ declarations, updateProp, removeProp }: Pro
113128
removeProp(Properties.FontFamily);
114129
}}
115130
>
116-
<TextBox value={declarations[Properties.FontFamily] || ''} onChange={value => updateProp(Properties.FontFamily, value)} />
131+
<TextBox
132+
value={declarations[Properties.FontFamily] || ""}
133+
onChange={value => updateProp(Properties.FontFamily, value)}
134+
/>
117135
</RowPropertyPanel>
118136
<RowPropertyPanel
119137
label="Text align"
@@ -125,26 +143,26 @@ export default function TextStyles({ declarations, updateProp, removeProp }: Pro
125143
options={[
126144
{
127145
icon: <AlignLeft size="13px" />,
128-
tooltip: 'Align left',
129-
value: 'left',
146+
tooltip: "Align left",
147+
value: "left"
130148
},
131149
{
132150
icon: <AlignCenter size="13px" />,
133-
tooltip: 'Align center',
134-
value: 'center',
151+
tooltip: "Align center",
152+
value: "center"
135153
},
136154
{
137155
icon: <AlignRight size="13px" />,
138-
tooltip: 'Align right',
139-
value: 'right',
156+
tooltip: "Align right",
157+
value: "right"
140158
},
141159
{
142160
icon: <AlignJustify size="13px" />,
143-
tooltip: 'Align justify',
144-
value: 'justify',
145-
},
161+
tooltip: "Align justify",
162+
value: "justify"
163+
}
146164
]}
147-
value={declarations[Properties.TextAlign] || ''}
165+
value={declarations[Properties.TextAlign] || ""}
148166
onChange={value => {
149167
updateProp(Properties.TextAlign, value);
150168
}}

src/ui/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import {
77
BordersProps,
88
BackgroundColorProps,
99
FontSizeProps,
10-
LineHeightProps,
11-
} from 'styled-system';
10+
LineHeightProps
11+
} from "styled-system";
1212

1313
export type StyleProps = FlexDirectionProps &
1414
SpaceProps &

0 commit comments

Comments
 (0)