Skip to content

Instantly share code, notes, and snippets.

View bogdanq's full-sized avatar
👀
hi!

Bogdan Shelomanov bogdanq

👀
hi!
View GitHub Profile
const GenericTemplate = ({ children, hero }) => {
return (
<Container>
<Header />
{hero}
{children}
<Footer />
</Container>
)
}
// 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) {
@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,
@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 / questions.md
Last active June 16, 2023 08:37
chart

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