Skip to content

Commit 7220b0b

Browse files
committedOct 7, 2019
chore: spacing fix
1 parent 3b6e346 commit 7220b0b

File tree

2 files changed

+39
-21
lines changed

2 files changed

+39
-21
lines changed
 

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

+38-20
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
33
import { css } from '@emotion/core';
4+
import styled from '@emotion/styled';
45
import { useIntl } from 'react-intl';
56
import filterDataAttributes from '../../../utils/filter-data-attributes';
67
import usePrevious from '../../../hooks/use-previous';
@@ -16,6 +17,10 @@ import { getLanguageLabelStyles } from './editor.styles';
1617

1718
const COLLAPSED_HEIGHT = 32;
1819

20+
const Wrapper = styled.div`
21+
flex: 1;
22+
`;
23+
1924
const Editor = props => {
2025
const intl = useIntl();
2126
const ref = React.useRef();
@@ -53,6 +58,8 @@ const Editor = props => {
5358
onToggle();
5459
}
5560

61+
const languagesControl = props.languagesControl();
62+
5663
return (
5764
<CollapsibleMotion
5865
minHeight={COLLAPSED_HEIGHT}
@@ -108,34 +115,45 @@ const Editor = props => {
108115
<div
109116
css={css`
110117
display: flex;
118+
119+
&:empty {
120+
margin: 0 !important;
121+
}
111122
`}
112123
>
113-
<div
114-
css={css`
115-
flex: 1;
116-
`}
117-
>
118-
{(() => {
119-
if (props.error) return <div>{props.error}</div>;
120-
if (props.warning) return <div>{props.warning}</div>;
121-
return props.languagesControl();
122-
})()}
123-
</div>
124-
<div
125-
css={css`
126-
flex: 0;
127-
`}
128-
>
129-
{renderToggleButton && isOpen && (
124+
{(() => {
125+
if (props.error)
126+
return (
127+
<Wrapper>
128+
<div>{props.error}</div>
129+
</Wrapper>
130+
);
131+
if (props.warning)
132+
return (
133+
<Wrapper>
134+
<div>{props.warning}</div>
135+
</Wrapper>
136+
);
137+
return (
138+
languagesControl && <Wrapper>{languagesControl}</Wrapper>
139+
);
140+
})()}
141+
{renderToggleButton && isOpen && (
142+
<div
143+
css={css`
144+
flex: 0;
145+
`}
146+
>
130147
<FlatButton
131148
onClick={toggle}
132149
label={intl.formatMessage(messages.collapse)}
133150
icon={<AngleUpIcon size="small" />}
134151
/>
135-
)}
136-
</div>
152+
</div>
153+
)}
154+
155+
{(props.error || props.warning) && props.languagesControl()}
137156
</div>
138-
{(props.error || props.warning) && props.languagesControl()}
139157
</Spacings.Stack>
140158
);
141159
}}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ const LocalizedMultilineTextInput = props => {
110110

111111
return (
112112
<Constraints.Horizontal constraint={props.horizontalConstraint}>
113-
<Spacings.Stack scale="s">
113+
<Spacings.Stack>
114114
{languages.map((language, index) => {
115115
const isFirstLanguage = index === 0;
116116
if (!isFirstLanguage && !areLanguagesOpened) return null;

0 commit comments

Comments
 (0)