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
type ItemsWithUnit<T> = T & { [P in keyof T & string as `_${P}`]: T[P] }; | |
const withUnit = <T>(items: T, unit = 'px'): ItemsWithUnit<T> => { | |
let newObj = {}; | |
Object.keys(items).forEach((key) => { | |
const originalElement = items[key as keyof T]; | |
if (typeof originalElement !== 'number') { | |
newObj = { | |
...newObj, | |
[key]: originalElement, |
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, {useContext, useState} from 'react' | |
import { ThemeContext } from 'styled-components'; | |
import Select from 'react-select' | |
const styles = { | |
control: (provided, { selectProps: { theme, anotherProp } }) => ({ | |
...provided, | |
background: anotherProp, | |
boxShadow: theme.shadow(), | |
border: 'none', |
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 { Route, Switch, withRouter } from 'react-router-dom' | |
import { Transition,TransitionGroup } from 'react-transition-group' | |
import { StaggeredMotion, spring } from 'react-motion' | |
import {timeout} from '../constants' | |
export const Component = memo(({param, status}) => { | |
const options = {stiffness: 470, damping: 25} | |
const defaultStyles = [{x: -50}, {x: -50}] | |
return( |
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, {useState} from 'react' | |
export const Input = () => { | |
const [ inputValue, setinputValue ] = useState() | |
const handleChange = ({ target: {value} }) => setinputValue(value) | |
return( | |
<input name='name' value={ inputValue } onChange={ handleChange }/> | |
) | |
} |
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 { MAILGUN_API_KEY: apiKey, DOMAIN: domain, RECEIVER_MAIL: receiver_mail } = process.env | |
const mailgun = require('mailgun-js')({ apiKey, domain }) | |
exports.handler = function(event, context, callback) { | |
if(event.httpMethod!='POST' || !event.body){ | |
return callback(new Error('An error occurred!')) | |
} | |
const data = JSON.parse(event.body) |