chore: add code formatting and linting (#952)
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import React from 'react'
|
||||
import React from 'react';
|
||||
import styled, { css } from 'react-emotion';
|
||||
import ReactToggled from 'react-toggled';
|
||||
import { colors, colorsRaw, shadows, transitions } from './styles';
|
||||
@ -11,7 +11,7 @@ const ToggleContainer = styled.span`
|
||||
width: 40px;
|
||||
height: 20px;
|
||||
cursor: pointer;
|
||||
`
|
||||
`;
|
||||
|
||||
const ToggleHandle = styled.span`
|
||||
${shadows.dropDeep};
|
||||
@ -24,17 +24,19 @@ const ToggleHandle = styled.span`
|
||||
background-color: ${colorsRaw.white};
|
||||
transition: transform ${transitions.main};
|
||||
|
||||
${props => props.isActive && css`
|
||||
transform: translateX(20px);
|
||||
`}
|
||||
`
|
||||
${props =>
|
||||
props.isActive &&
|
||||
css`
|
||||
transform: translateX(20px);
|
||||
`};
|
||||
`;
|
||||
|
||||
const ToggleBackground = styled.span`
|
||||
width: 34px;
|
||||
height: 14px;
|
||||
border-radius: 10px;
|
||||
background-color: ${colors.active};
|
||||
`
|
||||
`;
|
||||
|
||||
const Toggle = ({
|
||||
active,
|
||||
@ -47,7 +49,7 @@ const Toggle = ({
|
||||
Handle = ToggleHandle,
|
||||
}) => (
|
||||
<ReactToggled on={active} onToggle={onChange}>
|
||||
{({on, getElementTogglerProps}) => (
|
||||
{({ on, getElementTogglerProps }) => (
|
||||
<Container
|
||||
role="switch"
|
||||
aria-checked={on.toString()}
|
||||
@ -56,8 +58,8 @@ const Toggle = ({
|
||||
className={className}
|
||||
{...getElementTogglerProps()}
|
||||
>
|
||||
<Background isActive={on}/>
|
||||
<Handle isActive={on}/>
|
||||
<Background isActive={on} />
|
||||
<Handle isActive={on} />
|
||||
</Container>
|
||||
)}
|
||||
</ReactToggled>
|
||||
|
Reference in New Issue
Block a user