mirror of
https://github.com/twentyhq/twenty.git
synced 2024-11-26 13:42:44 +03:00
Fix links chip design (#5963)
Fix https://github.com/twentyhq/twenty/issues/5938 and https://github.com/twentyhq/twenty/issues/5655 - Make sure chip count is displayed - Fix padding - Fix background colors, border - Add hover and active states --------- Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
This commit is contained in:
parent
732653034e
commit
9a4a2e4ca9
@ -59,7 +59,7 @@ export const LinksDisplay = ({ value, isFocused }: LinksDisplayProps) => {
|
||||
);
|
||||
|
||||
return isFocused ? (
|
||||
<ExpandableList isChipCountDisplayed={isFocused}>
|
||||
<ExpandableList isChipCountDisplayed>
|
||||
{links.map(({ url, label, type }, index) =>
|
||||
type === LinkType.LinkedIn || type === LinkType.Twitter ? (
|
||||
<SocialLink key={index} href={url} type={type} label={label} />
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { MouseEvent } from 'react';
|
||||
import { MouseEvent, useContext } from 'react';
|
||||
import { styled } from '@linaria/react';
|
||||
import { isNonEmptyString } from '@sniptt/guards';
|
||||
import { FONT_COMMON, THEME_COMMON } from 'twenty-ui';
|
||||
import { FONT_COMMON, THEME_COMMON, ThemeContext } from 'twenty-ui';
|
||||
|
||||
type RoundedLinkProps = {
|
||||
href: string;
|
||||
@ -11,17 +11,23 @@ type RoundedLinkProps = {
|
||||
|
||||
const fontSizeMd = FONT_COMMON.size.md;
|
||||
const spacing1 = THEME_COMMON.spacing(1);
|
||||
const spacing3 = THEME_COMMON.spacing(3);
|
||||
const spacing2 = THEME_COMMON.spacing(2);
|
||||
|
||||
const spacingMultiplicator = THEME_COMMON.spacingMultiplicator;
|
||||
|
||||
const StyledLink = styled.a`
|
||||
const StyledLink = styled.a<{
|
||||
color: string;
|
||||
background: string;
|
||||
backgroundHover: string;
|
||||
backgroundActive: string;
|
||||
border: string;
|
||||
}>`
|
||||
align-items: center;
|
||||
background-color: var(--twentycrm-background-transparent-light);
|
||||
border: 1px solid var(--twentycrm-border-color-medium);
|
||||
background-color: ${({ background }) => background};
|
||||
border: 1px solid ${({ border }) => border};
|
||||
|
||||
border-radius: 50px;
|
||||
color: var(--twentycrm-font-color-primary);
|
||||
color: ${({ color }) => color};
|
||||
|
||||
cursor: pointer;
|
||||
display: inline-flex;
|
||||
@ -29,25 +35,39 @@ const StyledLink = styled.a`
|
||||
|
||||
gap: ${spacing1};
|
||||
|
||||
height: ${spacing3};
|
||||
height: 10px;
|
||||
justify-content: center;
|
||||
|
||||
max-width: calc(100% - ${spacingMultiplicator} * 2px);
|
||||
|
||||
max-width: 100%;
|
||||
|
||||
min-width: fit-content;
|
||||
|
||||
overflow: hidden;
|
||||
padding: ${spacing1} ${spacing1};
|
||||
padding: ${spacing1} ${spacing2};
|
||||
|
||||
text-decoration: none;
|
||||
text-overflow: ellipsis;
|
||||
user-select: none;
|
||||
white-space: nowrap;
|
||||
|
||||
&:hover {
|
||||
background-color: ${({ backgroundHover }) => backgroundHover};
|
||||
}
|
||||
|
||||
&:active {
|
||||
background-color: ${({ backgroundActive }) => backgroundActive};
|
||||
}
|
||||
`;
|
||||
|
||||
export const RoundedLink = ({ label, href, onClick }: RoundedLinkProps) => {
|
||||
const { theme } = useContext(ThemeContext);
|
||||
|
||||
const background = theme.background.transparent.lighter;
|
||||
const backgroundHover = theme.background.transparent.light;
|
||||
const backgroundActive = theme.background.transparent.medium;
|
||||
const border = theme.border.color.strong;
|
||||
const color = theme.font.color.primary;
|
||||
|
||||
if (!isNonEmptyString(label)) {
|
||||
return <></>;
|
||||
}
|
||||
@ -64,6 +84,11 @@ export const RoundedLink = ({ label, href, onClick }: RoundedLinkProps) => {
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
onClick={handleClick}
|
||||
color={color}
|
||||
background={background}
|
||||
backgroundHover={backgroundHover}
|
||||
backgroundActive={backgroundActive}
|
||||
border={border}
|
||||
>
|
||||
{label}
|
||||
</StyledLink>
|
||||
|
Loading…
Reference in New Issue
Block a user