Skip to content

Commit febcf72

Browse files
authored
Merge pull request #476 from AppQuality/fix-long-word-in-bug-details
fix(bug-details): break long words
2 parents 22864d0 + 06a82de commit febcf72

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/common/components/BugDetail/Description.tsx

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const Container = styled.div`
88
display: inline-block;
99
width: 100%;
1010
margin: ${({ theme }) => theme.space.lg} 0;
11-
white-space: pre-wrap;
11+
overflow-wrap: break-word;
1212
`;
1313

1414
const TextBlock = styled.div`
@@ -35,25 +35,36 @@ export default ({
3535
}) => {
3636
const { t } = useTranslation();
3737

38+
const wrapText = (text: string) => {
39+
const wrapped = text.split('\n').map((item) => (
40+
<>
41+
{item}
42+
<br />
43+
</>
44+
));
45+
46+
return wrapped;
47+
};
48+
3849
return (
3950
<Container>
4051
<TextBlock>
4152
<StyledLabel>
4253
{t('__BUGS_PAGE_BUG_DETAIL_DESCRIPTION_LABEL')}
4354
</StyledLabel>
44-
<Text>{bug.step_by_step}</Text>
55+
<Text>{wrapText(bug.step_by_step)}</Text>
4556
</TextBlock>
4657
<TextBlock>
4758
<StyledLabel>
4859
{t('__BUGS_PAGE_BUG_DETAIL_EXPECTED_RESULT_LABEL')}
4960
</StyledLabel>
50-
<Text>{bug.expected_result}</Text>
61+
<Text>{wrapText(bug.expected_result)}</Text>
5162
</TextBlock>
5263
<TextBlock>
5364
<StyledLabel>
5465
{t('__BUGS_PAGE_BUG_DETAIL_CURRENT_RESULT_LABEL')}
5566
</StyledLabel>
56-
<Text>{bug.current_result}</Text>
67+
<Text>{wrapText(bug.current_result)}</Text>
5768
</TextBlock>
5869

5970
<TextBlock>

0 commit comments

Comments
 (0)