mirror of
https://github.com/lingble/twenty.git
synced 2025-10-30 20:27:55 +00:00
refactor: create Checkbox component
This commit is contained in:
23
front/src/components/form/Checkbox.tsx
Normal file
23
front/src/components/form/Checkbox.tsx
Normal 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;
|
||||||
@@ -16,6 +16,7 @@ import CellLink from '../../components/table/CellLink';
|
|||||||
import ColumnHead from '../../components/table/ColumnHead';
|
import ColumnHead from '../../components/table/ColumnHead';
|
||||||
import personPlaceholder from './placeholder.png';
|
import personPlaceholder from './placeholder.png';
|
||||||
import { parsePhoneNumber, CountryCode } from 'libphonenumber-js';
|
import { parsePhoneNumber, CountryCode } from 'libphonenumber-js';
|
||||||
|
import Checkbox from '../../components/form/Checkbox';
|
||||||
|
|
||||||
type Person = {
|
type Person = {
|
||||||
fullName: string;
|
fullName: string;
|
||||||
@@ -106,11 +107,10 @@ const columns = [
|
|||||||
header: () => <ColumnHead viewName="People" viewIcon={faUser} />,
|
header: () => <ColumnHead viewName="People" viewIcon={faUser} />,
|
||||||
cell: (props) => (
|
cell: (props) => (
|
||||||
<>
|
<>
|
||||||
<input
|
<Checkbox
|
||||||
type="checkbox"
|
|
||||||
id={`person-selected-${props.row.original.email}`}
|
id={`person-selected-${props.row.original.email}`}
|
||||||
name={`person-selected${props.row.original.email}`}
|
name={`person-selected${props.row.original.email}`}
|
||||||
></input>
|
/>
|
||||||
<CellLink
|
<CellLink
|
||||||
name={props.row.original.fullName}
|
name={props.row.original.fullName}
|
||||||
picture={props.row.original.picture}
|
picture={props.row.original.picture}
|
||||||
|
|||||||
Reference in New Issue
Block a user