Skip to content

Commit

Permalink
feat(GoalListItem): state component instead of DotState
Browse files Browse the repository at this point in the history
  • Loading branch information
asabotovich committed May 30, 2023
1 parent 6afab2c commit 3679f04
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
12 changes: 4 additions & 8 deletions src/components/GoalListItem/GoalListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import NextLink from 'next/link';
import dynamic from 'next/dynamic';
import { gray4, textColor, gapS, gapXs, radiusM, gray9, gapSm } from '@taskany/colors';
import { MessageIcon, Text, Tag as TagItem, nullable } from '@taskany/bricks';
import type { Estimate, State, Tag } from '@prisma/client';
import type { Estimate, State as StateType, Tag } from '@prisma/client';

import { routes } from '../../hooks/router';
import { Priority } from '../../types/priority';
import { getPriorityText } from '../PriorityText/PriorityText';
import { StateDot } from '../StateDot';
import { ActivityByIdReturnType } from '../../../trpc/inferredTypes';
import { estimateToString } from '../../utils/estimateToString';
import { UserGroup } from '../UserGroup';
import { State } from '../State';

const RelativeTime = dynamic(() => import('../RelativeTime/RelativeTime'));

Expand All @@ -25,7 +25,7 @@ interface GoalListItemProps {
issuer?: ActivityByIdReturnType;
participants?: ActivityByIdReturnType[];
tags?: Array<Tag | undefined>;
state?: State;
state?: StateType;
createdAt: Date;
updatedAt: Date;
estimate?: Estimate;
Expand Down Expand Up @@ -139,10 +139,6 @@ const GoalTag = styled(TagItem)`
}
`;

const GoalStateDot = styled(StateDot)`
margin: 0 auto;
`;

const CommentsCountContainer = styled.div`
white-space: nowrap;
`;
Expand Down Expand Up @@ -209,7 +205,7 @@ export const GoalListItem: React.FC<GoalListItemProps> = React.memo(
</GoalTitleItem>
<GoalContentItem>
{nullable(state, (s) => (
<GoalStateDot size="m" hue={s.hue} />
<State size="s" title={s?.title} hue={s?.hue} />
))}
</GoalContentItem>
<GoalContentItem>
Expand Down
6 changes: 3 additions & 3 deletions src/components/State.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useEffect, useState } from 'react';
import styled from 'styled-components';
import colorLayer from 'color-layer';
import { gray6, radiusXl } from '@taskany/colors';
import { gapM, gapS, gapXs, gray6, radiusXl } from '@taskany/colors';

import { usePageContext } from '../hooks/usePageContext';

Expand Down Expand Up @@ -52,8 +52,8 @@ const StyledState = styled.div<{
${({ size }) =>
size === 's' &&
`
padding: 4px 10px;
`
padding: calc(${gapXs}/2) ${gapS};
font-size: 12px;
`}
`;
Expand Down

0 comments on commit 3679f04

Please sign in to comment.