refactor(TranslatePage.tsx): simplify OutputText styling for cleaner code structure
This commit is contained in:
parent
45bf3d4e86
commit
db3f8b8bee
@ -17,10 +17,8 @@ import TextArea from 'antd/es/input/TextArea'
|
|||||||
import { isEmpty } from 'lodash'
|
import { isEmpty } from 'lodash'
|
||||||
import { FC, useEffect, useState } from 'react'
|
import { FC, useEffect, useState } from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import Markdown from 'react-markdown'
|
|
||||||
import { Link } from 'react-router-dom'
|
import { Link } from 'react-router-dom'
|
||||||
import styled from 'styled-components'
|
import styled from 'styled-components'
|
||||||
import CodeBlock from '../home/components/CodeBlock'
|
|
||||||
|
|
||||||
let _text = ''
|
let _text = ''
|
||||||
let _result = ''
|
let _result = ''
|
||||||
@ -209,11 +207,7 @@ const TranslatePage: FC = () => {
|
|||||||
</TranslateButton>
|
</TranslateButton>
|
||||||
</InputContainer>
|
</InputContainer>
|
||||||
<OutputContainer>
|
<OutputContainer>
|
||||||
<OutputText>
|
<OutputText>{result || t('translate.output.placeholder')}</OutputText>
|
||||||
<Markdown className="markdown" components={{ code: CodeBlock as any }}>
|
|
||||||
{result || t('translate.output.placeholder')}
|
|
||||||
</Markdown>
|
|
||||||
</OutputText>
|
|
||||||
<CopyButton
|
<CopyButton
|
||||||
onClick={onCopy}
|
onClick={onCopy}
|
||||||
disabled={!result}
|
disabled={!result}
|
||||||
@ -293,9 +287,7 @@ const OutputText = styled.div`
|
|||||||
padding: 5px 10px;
|
padding: 5px 10px;
|
||||||
max-height: calc(100vh - var(--navbar-height) - 120px);
|
max-height: calc(100vh - var(--navbar-height) - 120px);
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
.markdown {
|
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
}
|
|
||||||
`
|
`
|
||||||
|
|
||||||
const TranslateButton = styled(Button)`
|
const TranslateButton = styled(Button)`
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user