1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-24 17:51:14 +02:00
unleash.unleash/frontend/src/component/changeRequest/ChangeRequestOverview/ChangeRequestComments/ChangeRequestComment.tsx
Nuno Góis 4167a60588
feat: biome lint frontend (#4903)
Follows up on https://github.com/Unleash/unleash/pull/4853 to add Biome
to the frontend as well.


![image](https://github.com/Unleash/unleash/assets/14320932/1906faf1-fc29-4172-a4d4-b2716d72cd65)

Added a few `biome-ignore` to speed up the process but we may want to
check and fix them in the future.
2023-10-02 13:25:46 +01:00

54 lines
1.8 KiB
TypeScript

import { FC } from 'react';
import Paper from '@mui/material/Paper';
import { Box, styled, Typography, Tooltip } from '@mui/material';
import TimeAgo from 'react-timeago';
import { StyledAvatar } from './StyledAvatar';
import { IChangeRequestComment } from '../../changeRequest.types';
import Linkify from 'react-linkify';
const ChangeRequestCommentWrapper = styled(Box)(({ theme }) => ({
display: 'flex',
marginTop: theme.spacing(2),
}));
const CommentPaper = styled(Paper)(({ theme }) => ({
width: '100%',
padding: theme.spacing(1.5, 3, 2.5, 3),
backgroundColor: theme.palette.neutral.light,
borderRadius: theme.shape.borderRadiusLarge,
borderColor: theme.palette.divider,
}));
const CommentHeader = styled(Box)(({ theme }) => ({
display: 'flex',
borderBottom: '1px solid',
borderColor: theme.palette.divider,
paddingBottom: theme.spacing(1.5),
}));
export const ChangeRequestComment: FC<{ comment: IChangeRequestComment }> = ({
comment,
}) => (
<ChangeRequestCommentWrapper>
<Tooltip title={comment.createdBy.username}>
<StyledAvatar src={comment.createdBy.imageUrl} />
</Tooltip>
<CommentPaper variant='outlined'>
<CommentHeader>
<Box>
<strong>{comment.createdBy.username}</strong>{' '}
<Typography color='text.secondary' component='span'>
commented{' '}
<TimeAgo
minPeriod={60}
date={new Date(comment.createdAt)}
/>
</Typography>
</Box>
</CommentHeader>
<Box sx={{ paddingTop: 2.5 }}>
<Linkify>{comment.text}</Linkify>
</Box>
</CommentPaper>
</ChangeRequestCommentWrapper>
);