Skip to content

Commit bd0ffdd

Browse files
committedOct 11, 2019
chore: margin fix
1 parent 20e00ad commit bd0ffdd

File tree

1 file changed

+31
-27
lines changed
  • src/components/inputs/localized-rich-text-input

1 file changed

+31
-27
lines changed
 

‎src/components/inputs/localized-rich-text-input/editor.js

+31-27
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,21 @@ import messages from './messages';
1616

1717
const COLLAPSED_HEIGHT = 32;
1818

19-
const Wrapper = styled.div`
19+
const LeftColumn = styled.div`
2020
flex: 1;
2121
`;
2222

23+
const RightColumn = styled.div`
24+
flex: 0;
25+
`;
26+
27+
const Row = styled.div`
28+
display: flex;
29+
&:empty {
30+
margin: 0 !important;
31+
}
32+
`;
33+
2334
const Editor = props => {
2435
const intl = useIntl();
2536
const ref = React.useRef();
@@ -111,46 +122,39 @@ const Editor = props => {
111122
{props.children}
112123
</RichTextBody>
113124
</div>
114-
<div
115-
css={css`
116-
display: flex;
117-
118-
&:empty {
119-
margin: 0 !important;
120-
}
121-
`}
122-
>
125+
<Row>
123126
{(() => {
124127
if (props.error)
125128
return (
126-
<Wrapper>
129+
<LeftColumn>
127130
<div>{props.error}</div>
128-
</Wrapper>
131+
</LeftColumn>
129132
);
130133
if (props.warning)
131134
return (
132-
<Wrapper>
135+
<LeftColumn>
133136
<div>{props.warning}</div>
134-
</Wrapper>
137+
</LeftColumn>
135138
);
136139
return (
137-
languagesControl && <Wrapper>{languagesControl}</Wrapper>
140+
languagesControl && (
141+
<LeftColumn>{languagesControl}</LeftColumn>
142+
)
138143
);
139144
})()}
140145
{renderToggleButton && isOpen && (
141-
<div
142-
css={css`
143-
flex: 0;
144-
`}
145-
>
146-
<FlatButton
147-
onClick={toggle}
148-
label={intl.formatMessage(messages.collapse)}
149-
icon={<AngleUpIcon size="small" />}
150-
/>
151-
</div>
146+
<React.Fragment>
147+
<LeftColumn />
148+
<RightColumn>
149+
<FlatButton
150+
onClick={toggle}
151+
label={intl.formatMessage(messages.collapse)}
152+
icon={<AngleUpIcon size="small" />}
153+
/>
154+
</RightColumn>
155+
</React.Fragment>
152156
)}
153-
</div>
157+
</Row>
154158
{(props.error || props.warning) && props.languagesControl()}
155159
</Spacings.Stack>
156160
);

0 commit comments

Comments
 (0)