Skip to content

Commit

Permalink
feat(IssueStats): header improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Troff8 committed Sep 19, 2023
1 parent d9061a0 commit a331042
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions src/components/IssueStats/IssueStats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@ import { useMemo } from 'react';
import styled from 'styled-components';
import { gapXs, gray8 } from '@taskany/colors';
import { Dot, Text, Link, nullable, CircleProgressBar } from '@taskany/bricks';
import { IconMessageOutline } from '@taskany/icons';

import { pluralize } from '../../utils/pluralize';
import { formatEstimate } from '../../utils/dateTime';
import { useLocale } from '../../hooks/useLocale';
import { ActivityByIdReturnType } from '../../../trpc/inferredTypes';
import { getPriorityText } from '../PriorityText/PriorityText';
import { UserGroup } from '../UserGroup';
import { RelativeTime } from '../RelativeTime/RelativeTime';

import { tr } from './IssueStats.i18n';

interface IssueStatsProps {
updatedAt: Date;
comments: number;
Expand All @@ -26,6 +24,7 @@ interface IssueStatsProps {
}

const StyledIssueStats = styled(Text)<Pick<IssueStatsProps, 'mode'>>`
display: flex;
${({ mode }) =>
mode === 'default' &&
`
Expand All @@ -34,22 +33,28 @@ const StyledIssueStats = styled(Text)<Pick<IssueStatsProps, 'mode'>>`
`;

const StyledDotSep = styled.span`
display: inline-block;
vertical-align: middle;
display: flex;
align-items: center;
}
`;

const StyledCircleProgressBar = styled(CircleProgressBar)`
vertical-align: middle;
`;

const StyledUserGroupContainer = styled.span`
display: flex;
vertical-align: middle;
`;
const CommentsCountIcon = styled(IconMessageOutline)`
display: inline-block;
vertical-align: middle;
`;

const DotSep: React.FC<{ children: React.ReactNode }> = ({ children }) => (
<StyledDotSep>
<Dot /> {children}
<Dot />
{children}
</StyledDotSep>
);

Expand Down Expand Up @@ -100,14 +105,7 @@ export const IssueStats: React.FC<IssueStatsProps> = ({
{nullable(comments, () => (
<DotSep>
<Link inline onClick={onCommentsClick}>
<b>{comments}</b>{' '}
{pluralize({
locale,
count: comments,
one: tr('one'),
few: tr('few'),
many: tr('many'),
})}
{comments} <CommentsCountIcon size="s" />
</Link>
</DotSep>
))}
Expand Down

0 comments on commit a331042

Please sign in to comment.