mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-04 20:00:00 +08:00
style: improved mermaid popup styling and positioning
This commit is contained in:
parent
bc479a999d
commit
367e99d698
@ -3,6 +3,7 @@ import { download } from '@renderer/utils/download'
|
|||||||
import { Button, Modal, Space, Tabs } from 'antd'
|
import { Button, Modal, Space, Tabs } from 'antd'
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
|
import styled from 'styled-components'
|
||||||
|
|
||||||
interface ShowParams {
|
interface ShowParams {
|
||||||
chart: string
|
chart: string
|
||||||
@ -97,6 +98,7 @@ const PopupContainer: React.FC<Props> = ({ resolve, chart }) => {
|
|||||||
onCancel={onCancel}
|
onCancel={onCancel}
|
||||||
afterClose={onClose}
|
afterClose={onClose}
|
||||||
width={1000}
|
width={1000}
|
||||||
|
centered
|
||||||
footer={[
|
footer={[
|
||||||
<Space key="download-buttons">
|
<Space key="download-buttons">
|
||||||
<Button onClick={() => handleDownload('svg')}>{t('mermaid.download.svg')}</Button>
|
<Button onClick={() => handleDownload('svg')}>{t('mermaid.download.svg')}</Button>
|
||||||
@ -109,18 +111,9 @@ const PopupContainer: React.FC<Props> = ({ resolve, chart }) => {
|
|||||||
key: 'preview',
|
key: 'preview',
|
||||||
label: t('mermaid.tabs.preview'),
|
label: t('mermaid.tabs.preview'),
|
||||||
children: (
|
children: (
|
||||||
<div
|
<StyledMermaid id={mermaidId} className="mermaid">
|
||||||
id={mermaidId}
|
|
||||||
className="mermaid"
|
|
||||||
style={{
|
|
||||||
maxHeight: 'calc(80vh - 200px)',
|
|
||||||
overflowY: 'auto',
|
|
||||||
padding: '16px',
|
|
||||||
display: 'flex',
|
|
||||||
justifyContent: 'center'
|
|
||||||
}}>
|
|
||||||
{chart}
|
{chart}
|
||||||
</div>
|
</StyledMermaid>
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -163,3 +156,9 @@ export default class MermaidPopup {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const StyledMermaid = styled.div`
|
||||||
|
max-height: calc(80vh - 200px);
|
||||||
|
text-align: center;
|
||||||
|
overflow-y: auto;
|
||||||
|
`
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user