diff --git a/packages/new-polymath-ui/src/components/inputs/Checkbox/Checkbox.tsx b/packages/new-polymath-ui/src/components/inputs/Checkbox/Checkbox.tsx index 0fa1e0e0f..bb8d13cdb 100644 --- a/packages/new-polymath-ui/src/components/inputs/Checkbox/Checkbox.tsx +++ b/packages/new-polymath-ui/src/components/inputs/Checkbox/Checkbox.tsx @@ -1,13 +1,12 @@ -import React, { FC, useState, Fragment } from 'react'; +import React, { FC, useState } from 'react'; import { uniqueId } from 'lodash'; import { InlineFlex } from '~/components/InlineFlex'; import { SvgCheckmark } from '~/images/icons/Checkmark'; import { FormikProxy, EnhancedComponentProps } from '../FormikProxy'; import * as sc from './styles'; -import { Label } from './Label'; interface Props { - onChange: (e: boolean) => void; + onChange: (e: any) => void; /** * Specify whether the toggle should be on by default */ @@ -38,33 +37,32 @@ export const CheckboxPrimitive: FC = ({ } return ( - - - { - onChange(e.currentTarget.checked); - }} + + { + onChange(e.target.checked); + }} + /> + + - - - - {label && ( - - - - )} - - + + {label && ( + + {label} + + )} + ); }; diff --git a/packages/new-polymath-ui/src/components/inputs/Checkbox/styles.ts b/packages/new-polymath-ui/src/components/inputs/Checkbox/styles.ts index 2d340182a..7d51834cd 100644 --- a/packages/new-polymath-ui/src/components/inputs/Checkbox/styles.ts +++ b/packages/new-polymath-ui/src/components/inputs/Checkbox/styles.ts @@ -1,5 +1,7 @@ import styled from 'styled-components'; import { Icon } from '~/components/Icon'; +import { InlineFlex } from '~/components/InlineFlex'; +import { Label } from './Label'; export const Input = styled.input` position: absolute; @@ -14,6 +16,14 @@ export const Input = styled.input` white-space: nowrap; `; +export const CheckboxInlineFlex = styled(InlineFlex)` + line-height: 18px; +`; + +export const CheckboxLabel = styled(Label)` + align-items: flex-start; +`; + export const CheckIcon = styled(Icon)` display: block; transition: ${({ theme }) => theme.transitions.hover.ms}ms; @@ -34,6 +44,7 @@ export const CheckboxInput = styled.label` height: 1.125rem; background-color: #fff; user-select: none; + align-items: flex-start; ${Input}:focus + & { border-color: ${({ theme }) => theme.colors.secondary};