This file contains hidden or 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 atm = (sum, limits) => { | |
| const nominals = Object.keys(limits) | |
| .map(Number) | |
| .sort((a, b) => a - b) | |
| const balance = Object.entries(limits).reduce((acc, [key, value]) => acc + key * value, 0) | |
| if (sum > balance) { | |
| return 'Не достатоно денег' | |
| } |
This file contains hidden or 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 getElementsPosition = () => { | |
| console.log("ok") | |
| const dimensions = [320, 480, 640, 960, 1200, 1400, 1600]; | |
| const nodes = [...document.querySelectorAll("[data-component-id]")]; | |
| const availableWidth = window.innerWidth; | |
| const media = dimensions.find((d) => d >= availableWidth); |
This file contains hidden or 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
| interface IUserContext { | |
| user: User_user; | |
| } | |
| export function onlyAuth(context: IUserContext) { | |
| return Boolean(context.user); | |
| } | |
| export function onlyAdAgent({ user }: IUserContext) { | |
| if (user && user.roles) { |
This file contains hidden or 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 Guard = ({ | |
| guards = [], | |
| redirect = "/", | |
| exact = true, | |
| component: Component, | |
| pageTitle, | |
| path, | |
| }) => { | |
| const { checkPermissions } = usePermissions(); | |
| const { loading } = useUser(); |
This file contains hidden or 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 |
This file contains hidden or 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 hidden or 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 hidden or 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)}; |
NewerOlder