refactor: create Checkbox component

This commit is contained in:
Sammy Teillet
2023-04-18 17:33:39 +02:00
parent 81da0f4e03
commit a855c474a0
2 changed files with 26 additions and 3 deletions

View File

@@ -0,0 +1,23 @@
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: #1111b7;
}
`;
function Checkbox({ name, id }: OwnProps) {
return (
<StyledContainer>
<input type="checkbox" id={id} name={name}></input>
</StyledContainer>
);
}
export default Checkbox;

View File

@@ -16,6 +16,7 @@ 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';
type Person = {
fullName: string;
@@ -106,11 +107,10 @@ const columns = [
header: () => <ColumnHead viewName="People" viewIcon={faUser} />,
cell: (props) => (
<>
<input
type="checkbox"
<Checkbox
id={`person-selected-${props.row.original.email}`}
name={`person-selected${props.row.original.email}`}
></input>
/>
<CellLink
name={props.row.original.fullName}
picture={props.row.original.picture}