Fixed padding and aligned for editor in readonly mode

This commit is contained in:
Jori Lallo
2017-07-16 14:50:34 -07:00
parent 3b2ad193d5
commit 306e81a731
3 changed files with 16 additions and 26 deletions

View File

@ -204,8 +204,10 @@ type KeyData = {
onSave={this.props.onSave} onSave={this.props.onSave}
readOnly={this.props.readOnly} readOnly={this.props.readOnly}
/> />
{!this.props.readOnly && <ClickablePadding
<ClickablePadding onClick={this.focusAtEnd} grow />} onClick={!this.props.readOnly ? this.focusAtEnd : undefined}
grow
/>
</MaxWidth> </MaxWidth>
</Flex> </Flex>
); );
@ -225,6 +227,7 @@ const HeaderContainer = styled(Flex).attrs({
align: 'flex-end', align: 'flex-end',
})` })`
height: 100px; height: 100px;
flex-shrink: 0;
${({ readOnly }) => !readOnly && 'cursor: text;'} ${({ readOnly }) => !readOnly && 'cursor: text;'}
`; `;

View File

@ -1,20 +1,22 @@
// @flow // @flow
import React from 'react'; import React from 'react';
import classnames from 'classnames'; import styled from 'styled-components';
import styles from './ClickablePadding.scss';
type Props = { type Props = {
onClick: Function, onClick?: ?Function,
grow?: boolean, grow?: boolean,
}; };
const ClickablePadding = (props: Props) => { const ClickablePadding = (props: Props) => {
return ( return <Container grow={props.grow} onClick={props.onClick} />;
<div
className={classnames(styles.container, { [styles.grow]: props.grow })}
onClick={props.onClick}
/>
);
}; };
const Container = styled.div`
min-height: 150px;
padding-top: 50px;
cursor: ${({ onClick }) => (onClick ? 'text' : 'default')};
${({ grow }) => grow && `flex-grow: 1;`}
`;
export default ClickablePadding; export default ClickablePadding;

View File

@ -1,15 +0,0 @@
.container {
min-height: 150px;
padding-top: 50px;
cursor: text;
}
.grow {
flex-grow: 1;
}
@media all and (max-width: 960px) {
.container {
padding-top: 50px;
}
}