docs: fix change-log button position (#49552)

* docs: fix changelog button position

* fix lint
This commit is contained in:
afc163 2024-06-22 16:51:41 +08:00 committed by GitHub
parent 7e74c79bdd
commit c5114b3f87
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 28 deletions

View File

@ -28,16 +28,6 @@ function matchDeprecated(v: string): MatchDeprecatedResult {
}
const useStyle = createStyles(({ token, css }) => ({
history: css`
position: absolute;
top: 0;
inset-inline-end: ${token.marginXS}px;
`,
li: css`
// white-space: pre;
`,
ref: css`
margin-inline-start: ${token.marginXS}px;
`,
@ -75,7 +65,7 @@ export interface ComponentChangelogProps {
const locales = {
cn: {
full: '完整更新日志',
full: '查看完整日志',
changelog: '更新日志',
loading: '加载中...',
empty: '暂无更新',
@ -213,7 +203,7 @@ const ComponentChangelog: React.FC<ComponentChangelogProps> = (props) => {
</Typography.Title>
<ul>
{changelogList.map<React.ReactNode>((info, index) => (
<li key={index} className={styles.li}>
<li key={index}>
<ParseChangelog {...info} styles={styles} />
</li>
))}
@ -234,7 +224,6 @@ const ComponentChangelog: React.FC<ComponentChangelogProps> = (props) => {
return (
<>
<Button
className={styles.history}
icon={<HistoryOutlined />}
onClick={() => {
setShow(true);

View File

@ -1,5 +1,5 @@
import React, { useContext, useLayoutEffect, useMemo, useState } from 'react';
import { Col, Flex, Typography } from 'antd';
import { Space, Col, Flex, Typography } from 'antd';
import { createStyles } from 'antd-style';
import classNames from 'classnames';
import { FormattedMessage, useRouteMeta } from 'dumi';
@ -70,10 +70,11 @@ const Content: React.FC<React.PropsWithChildren> = ({ children }) => {
</InViewSuspense>
<article className={classNames(styles.articleWrapper, { rtl: isRTL })}>
{meta.frontmatter?.title ? (
<Typography.Title style={{ fontSize: 30, position: 'relative' }}>
<Flex gap="small">
<div>{meta.frontmatter?.title}</div>
<div>{meta.frontmatter?.subtitle}</div>
<Flex justify="space-between">
<Typography.Title style={{ fontSize: 32, position: 'relative' }}>
<Space>
<span>{meta.frontmatter?.title}</span>
<span>{meta.frontmatter?.subtitle}</span>
{!pathname.startsWith('/components/overview') && (
<InViewSuspense fallback={null}>
<EditButton
@ -82,13 +83,14 @@ const Content: React.FC<React.PropsWithChildren> = ({ children }) => {
/>
</InViewSuspense>
)}
</Flex>
</Space>
</Typography.Title>
{pathname.startsWith('/components/') && (
<InViewSuspense fallback={null}>
<ComponentChangelog pathname={pathname} />
</InViewSuspense>
)}
</Typography.Title>
</Flex>
) : null}
<InViewSuspense fallback={null}>
<DocMeta />