Skip to content

Commit

Permalink
Preview icon styles fix. (#262)
Browse files Browse the repository at this point in the history
Added ability to see formatted text in entity preview
  • Loading branch information
Leshe4ka authored Nov 24, 2021
1 parent 02b115d commit 0aae422
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const ResultItem: React.FC<ResultItemProps> = ({
</Typography>
<AppTooltip
maxWidth={285}
sx={{ ml: 1.25, pr: 0.25 }}
sx={{ ml: 1.25, pr: 0.25, flexShrink: 0 }}
checkForOverflow={false}
title={({ open }) => (
<ResultItemPreviewContainer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ import {
import BooleanFormatted from 'components/shared/BooleanFormatted/BooleanFormatted';
import { format } from 'date-fns';
import AppCircularProgress from 'components/shared/AppCircularProgress/AppCircularProgress';
import cx from 'classnames';
import gfm from 'remark-gfm';
import ReactMarkdown from 'react-markdown';

interface ResultItemPreviewProps {
dataEntityId: number;
Expand Down Expand Up @@ -63,6 +66,17 @@ const ResultItemPreview: React.FC<ResultItemPreviewProps> = ({
return metadataVal;
};

const getDescription = React.useCallback(
() => (
<ReactMarkdown
className="markdown-body"
plugins={[gfm]}
source={dataEntityDetails?.internalDescription}
/>
),
[dataEntityDetails]
);

return (
<S.Container container>
{!isDataEntityLoading ? (
Expand Down Expand Up @@ -127,7 +141,9 @@ const ResultItemPreview: React.FC<ResultItemPreviewProps> = ({
</Typography>
</Grid>
<S.AboutText variant="body1" color="texts.secondary">
{dataEntityDetails?.internalDescription || 'Not created'}
{dataEntityDetails?.internalDescription
? getDescription()
: 'Not created'}
</S.AboutText>
</S.AboutContainer>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ export const Container = styled(Grid)(({ theme }) => ({
padding: theme.spacing(1),
width: '269px',
minHeight: '255px',
maxHeight: '400px',
overflowY: 'hidden',
}));

export const AboutContainer = styled(Grid)(({ theme }) => ({
Expand All @@ -14,8 +16,5 @@ export const AboutContainer = styled(Grid)(({ theme }) => ({
}));

export const AboutText = styled(Typography)(({ theme }) => ({
display: '-webkit-box',
overflow: 'hidden',
'-webkit-line-clamp': '4',
'-webkit-box-orient': 'vertical',
width: '100%',
}));

0 comments on commit 0aae422

Please sign in to comment.