feature: CellLinkacceptd children

This commit is contained in:
Sammy Teillet
2023-04-19 12:23:27 +02:00
parent 471d6743ad
commit 3696bf2617
2 changed files with 26 additions and 14 deletions

View File

@@ -1,19 +1,15 @@
import * as React from 'react'; import * as React from 'react';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import CompanyChip from '../chips/CompanyChip';
type OwnProps = { type OwnProps = {
name: string; name: string;
picture?: string; picture?: string;
href: string; href: string;
children?: React.ReactNode;
}; };
function CellLink({ name, picture, href }: OwnProps) { function CellLink({ href, children }: OwnProps) {
return ( return <Link to={href}>{children}</Link>;
<Link to={href}>
<CompanyChip name={name} picture={picture} />
</Link>
);
} }
export default CellLink; export default CellLink;

View File

@@ -18,6 +18,7 @@ import personPlaceholder from './placeholder.png';
import { parsePhoneNumber, CountryCode } from 'libphonenumber-js'; import { parsePhoneNumber, CountryCode } from 'libphonenumber-js';
import Checkbox from '../../components/form/Checkbox'; import Checkbox from '../../components/form/Checkbox';
import HorizontalyAlignedContainer from '../../layout/containers/HorizontalyAlignedContainer'; import HorizontalyAlignedContainer from '../../layout/containers/HorizontalyAlignedContainer';
import CompanyChip from '../../components/chips/CompanyChip';
type Person = { type Person = {
fullName: string; fullName: string;
@@ -116,7 +117,12 @@ const columns = [
name={props.row.original.fullName} name={props.row.original.fullName}
picture={props.row.original.picture} picture={props.row.original.picture}
href="#" href="#"
/> >
<CompanyChip
name={props.row.original.fullName}
picture={props.row.original.picture}
/>
</CellLink>
</HorizontalyAlignedContainer> </HorizontalyAlignedContainer>
), ),
}), }),
@@ -132,10 +138,15 @@ const columns = [
header: () => <ColumnHead viewName="Company" viewIcon={faBuildings} />, header: () => <ColumnHead viewName="Company" viewIcon={faBuildings} />,
cell: (props) => ( cell: (props) => (
<CellLink <CellLink
name={props.row.original.company.name} name={props.row.original.fullName}
picture={`https://www.google.com/s2/favicons?domain=${props.row.original.company.domain}&sz=256`} picture={props.row.original.picture}
href="#" href="#"
/> >
<CompanyChip
name={props.row.original.company.name}
picture={`https://www.google.com/s2/favicons?domain=${props.row.original.company.domain}&sz=256`}
/>
</CellLink>
), ),
}), }),
columnHelper.accessor('phone', { columnHelper.accessor('phone', {
@@ -167,10 +178,15 @@ const columns = [
header: () => <ColumnHead viewName="Pipe" viewIcon={faRectangleList} />, header: () => <ColumnHead viewName="Pipe" viewIcon={faRectangleList} />,
cell: (props) => ( cell: (props) => (
<CellLink <CellLink
name={props.row.original.pipe.name} name={props.row.original.fullName}
picture={props.row.original.pipe.icon} picture={props.row.original.picture}
href="#" href="#"
/> >
<CompanyChip
name={props.row.original.pipe.name}
picture={props.row.original.pipe.icon}
/>
</CellLink>
), ),
}), }),
columnHelper.accessor('city', { columnHelper.accessor('city', {