* Begin adding show view and refactoring threads to become notes * Progress on design * Progress redesign timeline * Dropdown button, design improvement * Open comment thread edit mode in drawer * Autosave local storage and commentThreadcount * Improve display and fix missing key issue * Remove some hardcoded CSS properties * Create button * Split company show into ui/business + fix eslint * Fix font weight * Begin auto-save on edit mode * Save server-side query result to Apollo cache * Fix save behavior * Refetch timeline after creating note * Rename createCommentThreadWithComment * Improve styling * Revert "Improve styling" This reverts commit 9fbbf2db006e529330edc64f3eb8ff9ecdde6bb0. * Improve CSS styling * Bring back border radius inadvertently removed * padding adjustment * Improve blocknote design * Improve edit mode display * Remove Comments.tsx * Remove irrelevant comment stories * Removed un-necessary panel component * stop using fragment, move trash icon * Add a basic story for CompanyShow * Add a basic People show view * Fix storybook tests * Add very basic Person story * Refactor PR1 * Refactor part 2 * Refactor part 3 * Refactor part 4 * Fix tests --------- Co-authored-by: Charles Bochet <charles@twenty.com>
62 lines
1.4 KiB
TypeScript
62 lines
1.4 KiB
TypeScript
import { useTheme } from '@emotion/react';
|
|
import styled from '@emotion/styled';
|
|
|
|
import { IconComment } from '@/ui/icons';
|
|
|
|
export type CommentChipProps = {
|
|
count: number;
|
|
onClick?: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
};
|
|
|
|
const StyledChip = styled.div`
|
|
align-items: center;
|
|
backdrop-filter: blur(6px);
|
|
|
|
background: ${({ theme }) => theme.background.transparent.primary};
|
|
border-radius: ${({ theme }) => theme.border.radius.md};
|
|
|
|
color: ${({ theme }) => theme.font.color.light};
|
|
cursor: pointer;
|
|
display: flex;
|
|
flex-direction: row;
|
|
gap: 4px;
|
|
|
|
height: 26px;
|
|
justify-content: center;
|
|
|
|
max-width: 42px;
|
|
|
|
padding-left: 4px;
|
|
|
|
padding-right: 4px;
|
|
|
|
&:hover {
|
|
background: ${({ theme }) => theme.background.tertiary};
|
|
color: ${({ theme }) => theme.font.color.tertiary};
|
|
}
|
|
|
|
user-select: none;
|
|
`;
|
|
|
|
const StyledCount = styled.div`
|
|
align-items: center;
|
|
display: flex;
|
|
font-size: ${({ theme }) => theme.font.size.sm};
|
|
font-weight: ${({ theme }) => theme.font.weight.medium};
|
|
justify-content: center;
|
|
`;
|
|
|
|
export function CommentChip({ count, onClick }: CommentChipProps) {
|
|
const theme = useTheme();
|
|
|
|
if (count === 0) return null;
|
|
const formattedCount = count > 99 ? '99+' : count;
|
|
|
|
return (
|
|
<StyledChip data-testid="comment-chip" onClick={onClick}>
|
|
<StyledCount>{formattedCount}</StyledCount>
|
|
<IconComment size={theme.icon.size.md} />
|
|
</StyledChip>
|
|
);
|
|
}
|