fix: Links field fixes (#5565)

Related issue: #3607
This commit is contained in:
Thaïs
2024-05-24 17:59:08 +02:00
committed by GitHub
parent fa3443c05b
commit 736c79afde
9 changed files with 84 additions and 106 deletions

View File

@ -1,5 +1,4 @@
import { MouseEvent } from 'react';
import styled from '@emotion/styled';
import { FieldLinkValue } from '@/object-record/record-field/types/FieldMetadata';
import { RoundedLink } from '@/ui/navigation/link/components/RoundedLink';
@ -11,15 +10,6 @@ import { checkUrlType } from '~/utils/checkUrlType';
import { getAbsoluteUrl } from '~/utils/url/getAbsoluteUrl';
import { getUrlHostName } from '~/utils/url/getUrlHostName';
import { EllipsisDisplay } from './EllipsisDisplay';
const StyledRawLink = styled(RoundedLink)`
a {
font-size: ${({ theme }) => theme.font.size.md};
white-space: nowrap;
}
`;
type LinkDisplayProps = {
value?: FieldLinkValue;
};
@ -35,18 +25,15 @@ export const LinkDisplay = ({ value }: LinkDisplayProps) => {
if (type === LinkType.LinkedIn || type === LinkType.Twitter) {
return (
<EllipsisDisplay>
<SocialLink href={absoluteUrl} onClick={handleClick} type={type}>
{displayedValue}
</SocialLink>
</EllipsisDisplay>
<SocialLink href={absoluteUrl} onClick={handleClick} type={type}>
{displayedValue}
</SocialLink>
);
}
return (
<EllipsisDisplay>
<StyledRawLink href={absoluteUrl} onClick={handleClick}>
{displayedValue}
</StyledRawLink>
</EllipsisDisplay>
<RoundedLink href={absoluteUrl} onClick={handleClick}>
{displayedValue}
</RoundedLink>
);
};