Skip to content

Instantly share code, notes, and snippets.

View smashercosmo's full-sized avatar

Vladislav Shkodin smashercosmo

View GitHub Profile
@smashercosmo
smashercosmo / Text.js
Last active June 6, 2018 14:36
shouldForwardProp
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 = {
import { Container } from 'unstated'
interface Organization {
id: string
}
interface OrganizationsState {
organizations: Organization[]
}
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) => {
import React from 'react'
import {
SubComponent1,
SubComponent2,
SubComponent3,
} from '../SubComponents/SubComponents'
interface IComponentProps {
className?: string
// @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,
// @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,
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 })
const propTypes = {
history: PropTypes.object.isRequired,
}
const NewProjectRoute = props => (
<Subscribe
to={[
OrganizationsContainer,
UserContainer,
UsersContainer,
import React from 'react'
import ExternalLinkIcon from './link.svg'
import HeaderNavigationItem from '../HeaderNavigationItem/HeaderNavigationItem'
import { TutorialContext } from '../Tutorial/TutorialProvider'
import style from './HeaderNavigation.scss'
function HeaderNavigation() {
return (