Skip to content

Instantly share code, notes, and snippets.

View bogdanq's full-sized avatar
👀
hi!

Bogdan Shelomanov bogdanq

👀
hi!
View GitHub Profile
@bogdanq
bogdanq / questions.md
Last active June 16, 2023 08:37
chart

Unit-тесты Jest TDD Snapshot E2E-тесты Как работает Скриншоты Opensource Commits, pull-requests, issues Просмотр кода на github

@bogdanq
bogdanq / with-account.js
Last active December 3, 2019 09:23
Компонент для обработки пользователя
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 })
}
@bogdanq
bogdanq / access.js
Last active July 28, 2020 07:09
access - компонент для проверки прав юзера
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,
// 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) {
const GenericTemplate = ({ children, hero }) => {
return (
<Container>
<Header />
{hero}
{children}
<Footer />
</Container>
)
}
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)};
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`
import styled from "styled-components";
const mapPoint = ({ position }) => ({
style: {
top: position.top,
left: position.left
}
});
// api styled позволяет через атрибуты навесить стили
import { TransitionGroup, CSSTransition } from "react-transition-group";
export const TransitionComponent = ({
children,
isAnimated,
classNames,
timeout
}) => (
<TransitionGroup>
<CSSTransition
import React from 'react'
import { Text, View } from 'react-native'
import { createAppContainer } from 'react-navigation'
import { createBottomTabNavigator } from 'react-navigation-tabs'
import { createStackNavigator } from 'react-navigation-stack'
const app = createStackNavigator({
Home: () => (
<View style={styles.container}>
<Text style={styles.paragraph}>Home Screen</Text>