diff --git a/front/src/components/form/Checkbox.tsx b/front/src/components/form/Checkbox.tsx new file mode 100644 index 000000000..48b159fc2 --- /dev/null +++ b/front/src/components/form/Checkbox.tsx @@ -0,0 +1,44 @@ +import * as React from 'react'; +import styled from '@emotion/styled'; + +type OwnProps = { + name: string; + id: string; +}; + +const StyledContainer = styled.span` + input[type='checkbox'] { + accent-color: ${(props) => props.theme.blue}; + margin: 8px; + height: 16px; + width: 16px; + } + + input[type='checkbox']::before { + content: ''; + border: 1px solid black; + width: 14px; + height: 14px; + border-radius: 2px; + display: block; + } + + input[type='checkbox']:checked::before { + border: 1px solid ${(props) => props.theme.blue}; + } +`; + +function Checkbox({ name, id }: OwnProps) { + return ( + + + + ); +} + +export default Checkbox; diff --git a/front/src/components/form/__stories__/Checkbox.stories.tsx b/front/src/components/form/__stories__/Checkbox.stories.tsx new file mode 100644 index 000000000..903095f62 --- /dev/null +++ b/front/src/components/form/__stories__/Checkbox.stories.tsx @@ -0,0 +1,20 @@ +import { MemoryRouter } from 'react-router-dom'; + +import Checkbox from '../Checkbox'; +import { ThemeProvider } from '@emotion/react'; +import { lightTheme } from '../../../layout/styles/themes'; + +export default { + title: 'Checkbox', + component: Checkbox, +}; + +export const RegularCheckbox = () => { + return ( + + + + + + ); +}; diff --git a/front/src/components/form/__tests__/Checkbox.test.tsx b/front/src/components/form/__tests__/Checkbox.test.tsx new file mode 100644 index 000000000..3e0180ad3 --- /dev/null +++ b/front/src/components/form/__tests__/Checkbox.test.tsx @@ -0,0 +1,12 @@ +import { render } from '@testing-library/react'; + +import { RegularCheckbox } from '../__stories__/Checkbox.stories'; + +it('Checks the NavItem renders', () => { + const { getByTestId } = render(); + + expect(getByTestId('input-checkbox')).toHaveAttribute( + 'name', + 'selected-company-1', + ); +}); diff --git a/front/src/layout/containers/HorizontalyAlignedContainer.tsx b/front/src/layout/containers/HorizontalyAlignedContainer.tsx new file mode 100644 index 000000000..6892b2fa3 --- /dev/null +++ b/front/src/layout/containers/HorizontalyAlignedContainer.tsx @@ -0,0 +1,16 @@ +import styled from '@emotion/styled'; + +type OwnProps = { + children: JSX.Element[]; +}; + +const StyledContainer = styled.div` + display: flex; + align-items: center; +`; + +function HorizontalyAlignedContainer({ children: children }: OwnProps) { + return {children}; +} + +export default HorizontalyAlignedContainer; diff --git a/front/src/pages/people/People.tsx b/front/src/pages/people/People.tsx index 64f3f893d..3135ce971 100644 --- a/front/src/pages/people/People.tsx +++ b/front/src/pages/people/People.tsx @@ -16,6 +16,8 @@ import CellLink from '../../components/table/CellLink'; import ColumnHead from '../../components/table/ColumnHead'; import personPlaceholder from './placeholder.png'; import { parsePhoneNumber, CountryCode } from 'libphonenumber-js'; +import Checkbox from '../../components/form/Checkbox'; +import HorizontalyAlignedContainer from '../../layout/containers/HorizontalyAlignedContainer'; type Person = { fullName: string; @@ -105,11 +107,17 @@ const columns = [ columnHelper.accessor('fullName', { header: () => , cell: (props) => ( - + + + + ), }), columnHelper.accessor('email', {