client: improve style

This commit is contained in:
fantasticit 2022-05-26 00:37:28 +08:00
parent 9c63c09f4d
commit 12476d8c06
5 changed files with 54 additions and 45 deletions

View File

@ -65,20 +65,25 @@ export const CommentItem: React.FC<IProps> = ({ comment, replyComment, editComme
export const CommentItemPlaceholder = () => { export const CommentItemPlaceholder = () => {
return ( return (
<div className={styles.wrap}> <Skeleton
<div className={styles.leftWrap}> active
<Skeleton.Avatar size="small" /> placeholder={
</div> <div className={styles.wrap}>
<div className={styles.rightWrap}> <div className={styles.leftWrap}>
<header> <Skeleton.Avatar size="small" />
<Skeleton.Title style={{ width: 120 }} />
</header>
<main>
<div>
<Skeleton.Paragraph style={{ width: '100%' }} rows={3} />
</div> </div>
</main> <div className={styles.rightWrap}>
</div> <header>
</div> <Skeleton.Title style={{ width: 120 }} />
</header>
<main>
<div>
<Skeleton.Paragraph style={{ width: '100%' }} rows={3} />
</div>
</main>
</div>
</div>
}
></Skeleton>
); );
}; };

View File

@ -1,4 +1,4 @@
import { Avatar, Banner, Button, Pagination, Space, Typography } from '@douyinfe/semi-ui'; import { Avatar, Banner, Button, Pagination, Space, Spin, Typography } from '@douyinfe/semi-ui';
import { DataRender } from 'components/data-render'; import { DataRender } from 'components/data-render';
import { useComments } from 'data/comment'; import { useComments } from 'data/comment';
import { useUser } from 'data/user'; import { useUser } from 'data/user';
@ -90,13 +90,7 @@ export const CommentEditor: React.FC<IProps> = ({ documentId }) => {
<DataRender <DataRender
loading={loading} loading={loading}
error={error} error={error}
loadingContent={ loadingContent={null}
<>
{Array.from({ length: 3 }, (_, i) => i).map((i) => (
<CommentItemPlaceholder key={i} />
))}
</>
}
normalContent={() => ( normalContent={() => (
<> <>
{commentsData.total > 0 && ( {commentsData.total > 0 && (

View File

@ -1,5 +1,5 @@
import { IconEdit } from '@douyinfe/semi-icons'; import { IconEdit } from '@douyinfe/semi-icons';
import { BackTop, Button, Layout, Nav, Skeleton, Space, Tooltip, Typography } from '@douyinfe/semi-ui'; import { BackTop, Button, Layout, Nav, Skeleton, Space, Spin, Tooltip, Typography } from '@douyinfe/semi-ui';
import cls from 'classnames'; import cls from 'classnames';
import { DataRender } from 'components/data-render'; import { DataRender } from 'components/data-render';
import { DocumentCollaboration } from 'components/document/collaboration'; import { DocumentCollaboration } from 'components/document/collaboration';
@ -79,7 +79,6 @@ export const DocumentReader: React.FC<IProps> = ({ documentId }) => {
}, [document]); }, [document]);
const actions = useMemo(() => { const actions = useMemo(() => {
console.log({ readable, editable });
return ( return (
<Space> <Space>
{document && ( {document && (
@ -135,21 +134,35 @@ export const DocumentReader: React.FC<IProps> = ({ documentId }) => {
<div className={cls(styles.editorWrap, editorWrapClassNames)} style={{ fontSize }}> <div className={cls(styles.editorWrap, editorWrapClassNames)} style={{ fontSize }}>
<div id="js-reader-container"> <div id="js-reader-container">
{document && <Seo title={document.title} />} {document && <Seo title={document.title} />}
{user && readable && ( {user &&
<CollaborationEditor (docAuthLoading ? (
editable={false} <div
user={user} style={{
id={documentId} minHeight: 240,
type="document" display: 'flex',
renderInEditorPortal={renderAuthor} alignItems: 'center',
onAwarenessUpdate={triggerJoinUser} justifyContent: 'center',
/> margin: 'auto',
)} }}
{user && ( >
<div className={styles.commentWrap}> <Spin />
<CommentEditor documentId={documentId} /> </div>
</div> ) : (
)} <CollaborationEditor
editable={false}
user={user}
id={documentId}
type="document"
renderInEditorPortal={renderAuthor}
onAwarenessUpdate={triggerJoinUser}
/>
))}
{user &&
(docAuthLoading ? null : (
<div className={styles.commentWrap}>
<CommentEditor documentId={documentId} />
</div>
))}
{!isMobile && authority && authority.editable && container && ( {!isMobile && authority && authority.editable && container && (
<BackTop style={editBtnStyle} onClick={gotoEdit} target={() => container} visibilityHeight={200}> <BackTop style={editBtnStyle} onClick={gotoEdit} target={() => container} visibilityHeight={200}>
<IconEdit /> <IconEdit />

View File

@ -2,7 +2,7 @@
display: flex; display: flex;
width: 100%; width: 100%;
height: 100%; height: 100%;
min-height: 100px; min-height: 240px;
overflow: hidden; overflow: hidden;
flex-direction: column; flex-direction: column;

View File

@ -98,11 +98,8 @@ export const CollaborationEditor = forwardRef((props: ICollaborationEditorProps,
<DataRender <DataRender
loading={loading} loading={loading}
loadingContent={ loadingContent={
<div style={{ width: 174, margin: 'auto' }}> <div style={{ margin: 'auto' }}>
<Spin tip="正在加载中..."> <Spin />
{/* FIXME: semi-design 的问题,不加 div文字会换行! */}
<div></div>
</Spin>
</div> </div>
} }
error={error} error={error}