client: improve style

pull/60/head
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 = () => {
return (
<div className={styles.wrap}>
<div className={styles.leftWrap}>
<Skeleton.Avatar size="small" />
</div>
<div className={styles.rightWrap}>
<header>
<Skeleton.Title style={{ width: 120 }} />
</header>
<main>
<div>
<Skeleton.Paragraph style={{ width: '100%' }} rows={3} />
<Skeleton
active
placeholder={
<div className={styles.wrap}>
<div className={styles.leftWrap}>
<Skeleton.Avatar size="small" />
</div>
</main>
</div>
</div>
<div className={styles.rightWrap}>
<header>
<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 { useComments } from 'data/comment';
import { useUser } from 'data/user';
@ -90,13 +90,7 @@ export const CommentEditor: React.FC<IProps> = ({ documentId }) => {
<DataRender
loading={loading}
error={error}
loadingContent={
<>
{Array.from({ length: 3 }, (_, i) => i).map((i) => (
<CommentItemPlaceholder key={i} />
))}
</>
}
loadingContent={null}
normalContent={() => (
<>
{commentsData.total > 0 && (

View File

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

View File

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

View File

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