Files
twenty/front/src/modules/ui/link/components/RoundedLink.tsx
T
gitstart-twenty 77a1840611 Chore(front): Create a custom eslint rule for Props naming (#1904)
Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Matheus <matheus_benini@hotmail.com>
Co-authored-by: bosiraphael <raphael.bosi@gmail.com>
2023-10-09 16:31:13 +02:00

41 lines
947 B
TypeScript

import * as React from 'react';
import { Link as ReactLink } from 'react-router-dom';
import styled from '@emotion/styled';
import { Chip } from '@/ui/chip/components/Chip';
import { ChipSize, ChipVariant } from '@/ui/chip/components/Chip';
type RoundedLinkProps = {
href: string;
children?: React.ReactNode;
onClick?: (event: React.MouseEvent<HTMLElement>) => void;
};
const StyledClickable = styled.div`
overflow: hidden;
white-space: nowrap;
a {
color: inherit;
text-decoration: none;
}
`;
export const RoundedLink = ({ children, href, onClick }: RoundedLinkProps) => (
<div>
{children !== '' ? (
<StyledClickable>
<ReactLink target="_blank" to={href} onClick={onClick}>
<Chip
label={`${children}`}
variant={ChipVariant.Rounded}
size={ChipSize.Small}
/>
</ReactLink>
</StyledClickable>
) : (
<></>
)}
</div>
);