Skip to content

Commit d6473c0

Browse files
authored
docs: fix playground style and enhance user experience (#277)
1 parent 14d47a0 commit d6473c0

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

.dumi/theme/builtins/Previewer/CodePreviewer.tsx

+7-5
Original file line numberDiff line numberDiff line change
@@ -390,11 +390,13 @@ createRoot(document.getElementById('container')).render(<Demo />);
390390
{!simplify && (
391391
<section className="code-box-meta markdown">
392392
<div className="code-box-title">
393-
<Tooltip title={originDebug ? <FormattedMessage id="app.demo.debug" /> : ''}>
394-
<a href={`#${asset.id}`} ref={anchorRef}>
395-
{localizedTitle}
396-
</a>
397-
</Tooltip>
393+
{localizedTitle && (
394+
<Tooltip title={originDebug ? <FormattedMessage id="app.demo.debug" /> : ''}>
395+
<a href={`#${asset.id}`} ref={anchorRef}>
396+
{localizedTitle}
397+
</a>
398+
</Tooltip>
399+
)}
398400
<EditButton
399401
title={<FormattedMessage id="app.content.edit-demo" />}
400402
filename={filename}

.dumi/theme/common/EditButton.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ const useStyle = createStyles(({ token, css }) => {
2121
display: inline-block;
2222
text-decoration: none;
2323
vertical-align: middle;
24+
pointer-events: auto;
25+
z-index: 999;
2426
margin-inline-start: ${token.marginXS}px;
2527
${iconCls} {
2628
display: block;

.dumi/theme/common/styles/Demo.tsx

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import React from 'react';
2-
import { css, Global } from '@emotion/react';
1+
import { Global, css } from '@emotion/react';
32
import { useTheme } from 'antd-style';
3+
import React from 'react';
44

55
const GlobalDemoStyles: React.FC = () => {
66
const token = useTheme();
@@ -74,6 +74,7 @@ const GlobalDemoStyles: React.FC = () => {
7474
&-title {
7575
position: absolute;
7676
top: -14px;
77+
height: auto;
7778
padding: 1px 8px;
7879
color: #777;
7980
background: ${token.colorBgContainer};
@@ -291,8 +292,8 @@ const GlobalDemoStyles: React.FC = () => {
291292
}
292293
293294
&-codesandbox {
294-
width: 16px;
295-
height: 16px;
295+
width: 14px;
296+
height: 14px;
296297
overflow: hidden;
297298
border: 0;
298299
cursor: pointer;

0 commit comments

Comments
 (0)