Merge pull request #51 from twentyhq/sammy/t-104-i-see-a-localized-date
Sammy/t 104 i see a localized date
This commit is contained in:
@ -4,14 +4,15 @@ import { Link } from 'react-router-dom';
|
|||||||
|
|
||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
href: string;
|
href: string;
|
||||||
id: string;
|
|
||||||
children?: React.ReactNode;
|
children?: React.ReactNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
const TD = styled.td`
|
const StyledClickable = styled.div`
|
||||||
position: relative;
|
position: relative;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
height: 32px;
|
height: 32px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
::before {
|
::before {
|
||||||
content: '';
|
content: '';
|
||||||
@ -23,6 +24,7 @@ const TD = styled.td`
|
|||||||
border: 1px solid ${(props) => props.theme.text20};
|
border: 1px solid ${(props) => props.theme.text20};
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
|
pointer-events: none;
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,13 +37,13 @@ const Container = styled.span`
|
|||||||
padding-left: ${(props) => props.theme.spacing(2)};
|
padding-left: ${(props) => props.theme.spacing(2)};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
function ClickableCell({ href, children, id }: OwnProps) {
|
function ClickableCell({ href, children }: OwnProps) {
|
||||||
return (
|
return (
|
||||||
<TD key={id}>
|
<StyledClickable>
|
||||||
<Link to={href}>
|
<Link to={href}>
|
||||||
<Container>{children}</Container>
|
<Container>{children}</Container>
|
||||||
</Link>
|
</Link>
|
||||||
</TD>
|
</StyledClickable>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,7 @@ const StyledTable = styled.table`
|
|||||||
:last-child {
|
:last-child {
|
||||||
border-right-color: transparent;
|
border-right-color: transparent;
|
||||||
}
|
}
|
||||||
:first-child {
|
:first-of-type {
|
||||||
border-left-color: transparent;
|
border-left-color: transparent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -46,7 +46,7 @@ const StyledTable = styled.table`
|
|||||||
:last-child {
|
:last-child {
|
||||||
border-right-color: transparent;
|
border-right-color: transparent;
|
||||||
}
|
}
|
||||||
:first-child {
|
:first-of-type {
|
||||||
border-left-color: transparent;
|
border-left-color: transparent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -89,9 +89,10 @@ function Table({ data, columns, viewName, viewIcon }: OwnProps) {
|
|||||||
{table.getRowModel().rows.map((row) => (
|
{table.getRowModel().rows.map((row) => (
|
||||||
<tr key={row.id}>
|
<tr key={row.id}>
|
||||||
{row.getVisibleCells().map((cell) => {
|
{row.getVisibleCells().map((cell) => {
|
||||||
return flexRender(
|
return (
|
||||||
cell.column.columnDef.cell,
|
<td key={cell.id}>
|
||||||
cell.getContext(),
|
{flexRender(cell.column.columnDef.cell, cell.getContext())}
|
||||||
|
</td>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@ -108,34 +108,32 @@ const columns = [
|
|||||||
columnHelper.accessor('fullName', {
|
columnHelper.accessor('fullName', {
|
||||||
header: () => <ColumnHead viewName="People" viewIcon={faUser} />,
|
header: () => <ColumnHead viewName="People" viewIcon={faUser} />,
|
||||||
cell: (props) => (
|
cell: (props) => (
|
||||||
<td key={props.cell.id}>
|
<>
|
||||||
<HorizontalyAlignedContainer>
|
<HorizontalyAlignedContainer>
|
||||||
<Checkbox
|
<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}`}
|
||||||
/>
|
/>
|
||||||
<PersonChip
|
<PersonChip
|
||||||
name={props.row.original.fullName}
|
name={props.row.original.fullName}
|
||||||
picture={props.row.original.picture}
|
picture={props.row.original.picture}
|
||||||
/>
|
/>
|
||||||
</HorizontalyAlignedContainer>
|
</HorizontalyAlignedContainer>
|
||||||
</td>
|
</>
|
||||||
),
|
),
|
||||||
}),
|
}),
|
||||||
columnHelper.accessor('email', {
|
columnHelper.accessor('email', {
|
||||||
header: () => <ColumnHead viewName="Email" viewIcon={faEnvelope} />,
|
header: () => <ColumnHead viewName="Email" viewIcon={faEnvelope} />,
|
||||||
cell: (props) => (
|
cell: (props) => (
|
||||||
<ClickableCell id={props.cell.id} href="#">
|
<ClickableCell href={`mailto:${props.row.original.email}`}>
|
||||||
<a href={`mailto:${props.row.original.email}`}>
|
{props.row.original.email}
|
||||||
{props.row.original.email}
|
|
||||||
</a>
|
|
||||||
</ClickableCell>
|
</ClickableCell>
|
||||||
),
|
),
|
||||||
}),
|
}),
|
||||||
columnHelper.accessor('company', {
|
columnHelper.accessor('company', {
|
||||||
header: () => <ColumnHead viewName="Company" viewIcon={faBuildings} />,
|
header: () => <ColumnHead viewName="Company" viewIcon={faBuildings} />,
|
||||||
cell: (props) => (
|
cell: (props) => (
|
||||||
<ClickableCell id={props.cell.id} href="#">
|
<ClickableCell href="#">
|
||||||
<CompanyChip
|
<CompanyChip
|
||||||
name={props.row.original.company.name}
|
name={props.row.original.company.name}
|
||||||
picture={`https://www.google.com/s2/favicons?domain=${props.row.original.company.domain}&sz=256`}
|
picture={`https://www.google.com/s2/favicons?domain=${props.row.original.company.domain}&sz=256`}
|
||||||
@ -146,25 +144,23 @@ const columns = [
|
|||||||
columnHelper.accessor('phone', {
|
columnHelper.accessor('phone', {
|
||||||
header: () => <ColumnHead viewName="Phone" viewIcon={faPhone} />,
|
header: () => <ColumnHead viewName="Phone" viewIcon={faPhone} />,
|
||||||
cell: (props) => (
|
cell: (props) => (
|
||||||
<ClickableCell id={props.cell.id} href="#">
|
<ClickableCell
|
||||||
<a
|
href={parsePhoneNumber(
|
||||||
href={parsePhoneNumber(
|
props.row.original.phone,
|
||||||
props.row.original.phone,
|
props.row.original.countryCode as CountryCode,
|
||||||
props.row.original.countryCode as CountryCode,
|
)?.getURI()}
|
||||||
)?.getURI()}
|
>
|
||||||
>
|
{parsePhoneNumber(
|
||||||
{parsePhoneNumber(
|
props.row.original.phone,
|
||||||
props.row.original.phone,
|
props.row.original.countryCode as CountryCode,
|
||||||
props.row.original.countryCode as CountryCode,
|
)?.formatInternational() || props.row.original.phone}
|
||||||
)?.formatInternational() || props.row.original.phone}
|
|
||||||
</a>
|
|
||||||
</ClickableCell>
|
</ClickableCell>
|
||||||
),
|
),
|
||||||
}),
|
}),
|
||||||
columnHelper.accessor('creationDate', {
|
columnHelper.accessor('creationDate', {
|
||||||
header: () => <ColumnHead viewName="Creation" viewIcon={faCalendar} />,
|
header: () => <ColumnHead viewName="Creation" viewIcon={faCalendar} />,
|
||||||
cell: (props) => (
|
cell: (props) => (
|
||||||
<ClickableCell id={props.cell.id} href="#">
|
<ClickableCell href="#">
|
||||||
{new Intl.DateTimeFormat(undefined, {
|
{new Intl.DateTimeFormat(undefined, {
|
||||||
month: 'short',
|
month: 'short',
|
||||||
day: 'numeric',
|
day: 'numeric',
|
||||||
@ -176,17 +172,13 @@ const columns = [
|
|||||||
columnHelper.accessor('pipe', {
|
columnHelper.accessor('pipe', {
|
||||||
header: () => <ColumnHead viewName="Pipe" viewIcon={faRectangleHistory} />,
|
header: () => <ColumnHead viewName="Pipe" viewIcon={faRectangleHistory} />,
|
||||||
cell: (props) => (
|
cell: (props) => (
|
||||||
<ClickableCell id={props.cell.id} href="#">
|
<ClickableCell href="#">{props.row.original.pipe.name}</ClickableCell>
|
||||||
{props.row.original.pipe.name}
|
|
||||||
</ClickableCell>
|
|
||||||
),
|
),
|
||||||
}),
|
}),
|
||||||
columnHelper.accessor('city', {
|
columnHelper.accessor('city', {
|
||||||
header: () => <ColumnHead viewName="City" viewIcon={faMapPin} />,
|
header: () => <ColumnHead viewName="City" viewIcon={faMapPin} />,
|
||||||
cell: (props) => (
|
cell: (props) => (
|
||||||
<ClickableCell id={props.cell.id} href="#">
|
<ClickableCell href="#">{props.row.original.city}</ClickableCell>
|
||||||
{props.row.original.city}
|
|
||||||
</ClickableCell>
|
|
||||||
),
|
),
|
||||||
}),
|
}),
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user