This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import styled from 'react-emotion' | |
import { string } from 'prop-types' | |
import isPropValid from '@emotion/is-prop-valid' | |
const color = props => { | |
if (props.color) return { color: props.color } | |
return null | |
} | |
export const TextProps = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import { NavLink, NavLinkProps } from 'react-router-dom' | |
export type LinkProps = | |
| NavLinkProps | |
| React.AnchorHTMLAttributes<HTMLAnchorElement> | |
function isNavLink(props: any): props is NavLinkProps { | |
return props.to !== undefined | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Container } from 'unstated' | |
interface Organization { | |
id: string | |
} | |
interface OrganizationsState { | |
organizations: Organization[] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const itemsByDate = items.reduce((acc, item) => { | |
const date = formatDate(new Date(item.datetime), token); | |
acc[date] = acc[date] ? acc[date].concat(item) : [item]; | |
return acc; | |
}, {}) | |
// можно как угодно отсортировать даты | |
const sortedDates = Object.keys(itemsByDate).sort() | |
const Items = sortedDates.reduce((acc, date) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import { | |
SubComponent1, | |
SubComponent2, | |
SubComponent3, | |
} from '../SubComponents/SubComponents' | |
interface IComponentProps { | |
className?: string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @flow | |
import React from 'react' | |
import { createSelector } from 'reselect' | |
import queryString from 'query-string' | |
import { type Location } from 'react-router-dom' | |
import Box from '../../components/Box/Box' | |
import { | |
OrganizationsContainer, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @flow | |
import React from 'react' | |
import Box from '../../components/Box/Box' | |
import { type Organizations } from '../../state/organizations' | |
import OrganizationsList from '../../components/OrganizationsList/OrganizationsList' | |
export type OrganizationsPageProps = { | |
organizations: Organizations, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function handlePasswordChange({ currentPassword, newPassword }) { | |
await this.props.userState.changePassword({ currentPassword, newPassword }) | |
this.props.messageState.add({ | |
type: 'ok', | |
text: 'Password changed.', | |
}) | |
} | |
async function handleUserUpdate({ firstName, lastName }) { | |
await this.props.userState.update({ firstName, lastName }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const propTypes = { | |
history: PropTypes.object.isRequired, | |
} | |
const NewProjectRoute = props => ( | |
<Subscribe | |
to={[ | |
OrganizationsContainer, | |
UserContainer, | |
UsersContainer, |