Flow for all the files
This commit is contained in:
@ -1,8 +1,11 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
|
||||
import styles from './HeaderAction.scss';
|
||||
|
||||
const HeaderAction = props => {
|
||||
type Props = { onClick?: ?Function, children?: ?React.Element<any> };
|
||||
|
||||
const HeaderAction = (props: Props) => {
|
||||
return (
|
||||
<div onClick={props.onClick} className={styles.container}>
|
||||
{props.children}
|
||||
@ -10,8 +13,4 @@ const HeaderAction = props => {
|
||||
);
|
||||
};
|
||||
|
||||
HeaderAction.propTypes = {
|
||||
onClick: React.PropTypes.func,
|
||||
};
|
||||
|
||||
export default HeaderAction;
|
||||
|
@ -1,2 +1,3 @@
|
||||
// @flow
|
||||
import HeaderAction from './HeaderAction';
|
||||
export default HeaderAction;
|
||||
|
@ -1,14 +1,17 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import { observer } from 'mobx-react';
|
||||
|
||||
@observer class SaveAction extends React.Component {
|
||||
static propTypes = {
|
||||
onClick: React.PropTypes.func.isRequired,
|
||||
disabled: React.PropTypes.bool,
|
||||
isNew: React.PropTypes.bool,
|
||||
};
|
||||
type Props = {
|
||||
onClick: Function,
|
||||
disabled?: boolean,
|
||||
isNew?: boolean,
|
||||
};
|
||||
|
||||
onClick = event => {
|
||||
@observer class SaveAction extends React.Component {
|
||||
props: Props;
|
||||
|
||||
onClick = (event: MouseEvent) => {
|
||||
if (this.props.disabled) return;
|
||||
|
||||
event.preventDefault();
|
||||
|
@ -1,2 +1,3 @@
|
||||
// @flow
|
||||
import SaveAction from './SaveAction';
|
||||
export default SaveAction;
|
||||
|
@ -4,9 +4,9 @@ import _ from 'lodash';
|
||||
import styled from 'styled-components';
|
||||
|
||||
type Props = {
|
||||
children: string,
|
||||
content: string,
|
||||
truncate?: number,
|
||||
placeholder: string,
|
||||
placeholder?: ?string,
|
||||
};
|
||||
|
||||
class Title extends React.Component {
|
||||
@ -15,9 +15,9 @@ class Title extends React.Component {
|
||||
render() {
|
||||
let title;
|
||||
if (this.props.truncate) {
|
||||
title = _.truncate(this.props.children, this.props.truncate);
|
||||
title = _.truncate(this.props.content, this.props.truncate);
|
||||
} else {
|
||||
title = this.props.children;
|
||||
title = this.props.content;
|
||||
}
|
||||
|
||||
let usePlaceholder;
|
||||
@ -29,7 +29,7 @@ class Title extends React.Component {
|
||||
return (
|
||||
<span>
|
||||
{title && <span> / </span>}
|
||||
<TitleText title={this.props.children} untitled={usePlaceholder}>
|
||||
<TitleText title={this.props.content} untitled={usePlaceholder}>
|
||||
{title}
|
||||
</TitleText>
|
||||
</span>
|
||||
|
Reference in New Issue
Block a user