Improve loading state

This commit is contained in:
Tom Moor
2018-11-18 21:27:50 -08:00
parent 8208a6128a
commit 45445606b4
2 changed files with 15 additions and 4 deletions

View File

@@ -31,6 +31,8 @@ const RealInput = styled.input`
const Wrapper = styled.div`
max-width: ${props => (props.short ? '350px' : '100%')};
min-height: ${({ minHeight }) => (minHeight ? `${minHeight}px` : '0')};
max-height: ${({ maxHeight }) => (maxHeight ? `${maxHeight}px` : 'auto')};
`;
export const Outline = styled(Flex)`

View File

@@ -4,7 +4,7 @@ import { observable } from 'mobx';
import { observer, inject } from 'mobx-react';
import { withRouter } from 'react-router-dom';
import styled from 'styled-components';
import { LabelText, Outline } from 'components/Input';
import Input, { LabelText, Outline } from 'components/Input';
type Props = {
label: string,
@@ -35,9 +35,18 @@ class InputRich extends React.Component<Props> {
return (
<React.Fragment>
<LabelText>{label}</LabelText>
<StyledOutline maxHeight={maxHeight} minHeight={minHeight}>
{Editor && <Editor {...rest} />}
</StyledOutline>
{Editor ? (
<StyledOutline maxHeight={maxHeight} minHeight={minHeight}>
<Editor {...rest} />
</StyledOutline>
) : (
<Input
maxHeight={maxHeight}
minHeight={minHeight}
placeholder="Loading…"
disabled
/>
)}
</React.Fragment>
);
}