Flow for all the files

This commit is contained in:
Jori Lallo
2017-05-11 17:23:56 -07:00
parent a98199599a
commit 0a76d6af9e
110 changed files with 512 additions and 269 deletions

View File

@ -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;

View File

@ -1,2 +1,3 @@
// @flow
import HeaderAction from './HeaderAction';
export default HeaderAction;

View File

@ -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();

View File

@ -1,2 +1,3 @@
// @flow
import SaveAction from './SaveAction';
export default SaveAction;

View File

@ -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>&nbsp;/&nbsp;</span>}
<TitleText title={this.props.children} untitled={usePlaceholder}>
<TitleText title={this.props.content} untitled={usePlaceholder}>
{title}
</TitleText>
</span>