Unit-тесты Jest TDD Snapshot E2E-тесты Как работает Скриншоты Opensource Commits, pull-requests, issues Просмотр кода на github
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
export const WithAccount = ({ renderExists, renderEmpty, render }) => { | |
const { user } = $userStore() | |
if (user && renderExists) { | |
return renderExists({ account: user, accountId: user.id }) | |
} | |
if (!user && renderEmpty) { | |
return renderEmpty({ account: null, accountId: null }) | |
} |
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
export const Access = ({ guards = [], children, name = "" }) => { | |
const { checkPermissions } = usePermissions(); | |
const { loading } = useUser(); | |
const { hiddenPages, hiddenComponents } = React.useContext( | |
configContext, | |
); | |
const hasCompletedGuards = React.useMemo(() => checkPermissions(guards), [ | |
guards, | |
checkPermissions, |
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
// test https://github.com/bogdanq/jest-testing/blob/master/src/components/testing-library/components/conditional-list/conditional-list.spec.js | |
import React from 'react' | |
import { Spiner } from '@ui' | |
export const ConditionalList = ({ data, renderExist, renderEmpty, error, loading }) => { | |
if (!data) { | |
return <h1>Данных нет</h1>; | |
} | |
if (error) { |
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 GenericTemplate = ({ children, hero }) => { | |
return ( | |
<Container> | |
<Header /> | |
{hero} | |
{children} | |
<Footer /> | |
</Container> | |
) | |
} |
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 { css } from 'styled-components' | |
export const WithTag = ({ as = 'div', children, to, onClick, ...props }) => | |
React.createElement(as, { to, onClick, ...props }, children) | |
const prop = value => (is(value) ? value : 'initial') | |
export const mixins = props => css` | |
align-content: ${prop(props.alignContent)}; |
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, { css } from "styled-components"; | |
const getStyle = (propsName, styles) => props => | |
props[propsName] && styles[props[propsName]]; | |
const is = value => Boolean(value) | |
const ifProps = (name, styles) => props => is(props[name]) && styles | |
const buttonStyle = { | |
mini: css` |
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 "styled-components"; | |
const mapPoint = ({ position }) => ({ | |
style: { | |
top: position.top, | |
left: position.left | |
} | |
}); | |
// api styled позволяет через атрибуты навесить стили |
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 { TransitionGroup, CSSTransition } from "react-transition-group"; | |
export const TransitionComponent = ({ | |
children, | |
isAnimated, | |
classNames, | |
timeout | |
}) => ( | |
<TransitionGroup> | |
<CSSTransition |
OlderNewer