style: update style for document iframe in modal

pull/90/head
moonrailgun 2 years ago
parent fbda5751bf
commit 647e7e0f04

@ -266,7 +266,7 @@ export const ModalWrapper: React.FC<
return (
<div
className={clsx('p-4', props.className)}
className={clsx('tc-modal', 'p-4', props.className)}
style={{ minWidth: isMobile ? 290 : 420, ...props.style }}
>
{title}

@ -1,8 +1,17 @@
import { Problem } from '@/components/Problem';
import React from 'react';
import styled from 'styled-components';
import { isValidStr, t } from 'tailchat-shared';
import { DocumentMarkdownRender } from './DocumentMarkdownRender';
const DocumentIframe = styled.iframe`
.tc-modal & {
width: 60vw;
height: 70vh;
min-width: 100%;
}
`;
interface DocumentViewProps {
documentUrl?: string;
}
@ -16,7 +25,7 @@ export const DocumentView: React.FC<DocumentViewProps> = React.memo((props) => {
if (documentUrl.endsWith('.md')) {
return <DocumentMarkdownRender url={documentUrl} />;
} else if (documentUrl.endsWith('.html') || documentUrl.startsWith('http')) {
return <iframe src={documentUrl} />;
return <DocumentIframe src={documentUrl} />;
} else {
return <Problem text={t('不支持渲染的文档链接')} />;
}

Loading…
Cancel
Save