* Write Storybook tests for front/src/modules/ui/field/meta-types/display components Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: FellipeMTX <fellipefacdir@gmail.com> * Write Storybook tests for front/src/modules/ui/field/meta-types/display components Co-authored-by: FellipeMTX <fellipefacdir@gmail.com> Co-authored-by: v1b3m <vibenjamin6@gmail.com> * Write Storybook tests for front/src/modules/ui/field/meta-types/display components Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: FellipeMTX <fellipefacdir@gmail.com> * add EllipsisDisplay component * add EllipsisDisplay component * modified ComponentDecorator to pass a minWidth parameter to test ellipsis * add ellipsis test to all components * add ellipsis to links * removed minWidth and set it to 'unset' if the width is not defined --------- Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: FellipeMTX <fellipefacdir@gmail.com> Co-authored-by: bosiraphael <raphael.bosi@gmail.com>
44 lines
950 B
TypeScript
44 lines
950 B
TypeScript
import * as React from 'react';
|
|
import { Link as ReactLink } from 'react-router-dom';
|
|
import styled from '@emotion/styled';
|
|
|
|
type ContactLinkProps = {
|
|
className?: string;
|
|
href: string;
|
|
children?: React.ReactNode;
|
|
onClick?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
};
|
|
|
|
const StyledClickable = styled.div`
|
|
display: flex;
|
|
overflow: hidden;
|
|
white-space: nowrap;
|
|
|
|
a {
|
|
color: inherit;
|
|
overflow: hidden;
|
|
text-decoration: underline;
|
|
text-decoration-color: ${({ theme }) => theme.border.color.strong};
|
|
text-overflow: ellipsis;
|
|
|
|
&:hover {
|
|
text-decoration-color: ${({ theme }) => theme.font.color.primary};
|
|
}
|
|
}
|
|
`;
|
|
|
|
export const ContactLink = ({
|
|
className,
|
|
href,
|
|
children,
|
|
onClick,
|
|
}: ContactLinkProps) => (
|
|
<div>
|
|
<StyledClickable className={className}>
|
|
<ReactLink target="_blank" onClick={onClick} to={href}>
|
|
{children}
|
|
</ReactLink>
|
|
</StyledClickable>
|
|
</div>
|
|
);
|