Skip to content

Commit e7ff6d6

Browse files
committed
docs: update doc
1 parent b2b500f commit e7ff6d6

File tree

3 files changed

+73
-57
lines changed

3 files changed

+73
-57
lines changed

site/components/demoBox.vue

+24-22
Original file line numberDiff line numberDiff line change
@@ -13,29 +13,9 @@
1313
<section class="code-box-meta markdown">
1414
<slot v-if="isZhCN" name="description" />
1515
<slot v-else name="us-description" />
16-
<a-tooltip :title="codeExpand ? 'Hide Code' : 'Show Code'">
17-
<span class="code-expand-icon">
18-
<img
19-
width="16"
20-
alt="expand code"
21-
src="https://gw.alipayobjects.com/zos/rmsportal/wSAkBuJFbdxsosKKpqyq.svg"
22-
:class="codeExpand ? 'code-expand-icon-hide' : 'code-expand-icon-show'"
23-
@click="handleCodeExpand"
24-
/>
25-
<img
26-
width="16"
27-
alt="expand code"
28-
src="https://gw.alipayobjects.com/zos/rmsportal/OpROPHYqWmrMDBFMZtKF.svg"
29-
:class="codeExpand ? 'code-expand-icon-show' : 'code-expand-icon-hide'"
30-
@click="handleCodeExpand"
31-
/>
32-
</span>
33-
</a-tooltip>
34-
</section>
35-
<transition appear :css="false" @enter="enter" @leave="leave">
36-
<section v-show="codeExpand" class="highlight-wrapper" style="position: relative;">
16+
<div class="code-box-actions">
3717
<a-tooltip
38-
:title="copied ? '复制成功' : '复制代码'"
18+
:title="copied ? 'Copied!' : 'Copy code'"
3919
:visible="copyTooltipVisible"
4020
@visibleChange="onCopyTooltipVisibleChange"
4121
>
@@ -46,6 +26,28 @@
4626
class="code-box-code-copy"
4727
/>
4828
</a-tooltip>
29+
<a-tooltip :title="codeExpand ? 'Hide Code' : 'Show Code'">
30+
<span class="code-expand-icon">
31+
<img
32+
width="16"
33+
alt="expand code"
34+
src="https://gw.alipayobjects.com/zos/rmsportal/wSAkBuJFbdxsosKKpqyq.svg"
35+
:class="codeExpand ? 'code-expand-icon-hide' : 'code-expand-icon-show'"
36+
@click="handleCodeExpand"
37+
/>
38+
<img
39+
width="16"
40+
alt="expand code"
41+
src="https://gw.alipayobjects.com/zos/rmsportal/OpROPHYqWmrMDBFMZtKF.svg"
42+
:class="codeExpand ? 'code-expand-icon-show' : 'code-expand-icon-hide'"
43+
@click="handleCodeExpand"
44+
/>
45+
</span>
46+
</a-tooltip>
47+
</div>
48+
</section>
49+
<transition appear :css="false" @enter="enter" @leave="leave">
50+
<section v-show="codeExpand" class="highlight-wrapper" style="position: relative;">
4951
<slot name="code" />
5052
</section>
5153
</transition>

site/index.less

+2-7
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,14 @@ pre > code[class*='language-'] {
5656
position: absolute;
5757
top: -14px;
5858
padding: 1px 8px;
59-
margin-left: -8px;
59+
margin-left: 16px;
6060
color: #777;
6161
border-radius: 2px 2px 0 0;
6262
background: #fff;
6363
font-size: 14px;
6464
width: auto;
6565
}
66-
.code-box-code-copy {
67-
opacity: 1;
68-
position: absolute;
69-
right: 15px;
70-
top: 10px;
71-
}
66+
7267
#search-box {
7368
.ant-select-focused,
7469
.ant-select-selection,

site/theme/static/demo.less

+47-28
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,10 @@
7373
&-meta {
7474
&.markdown {
7575
position: relative;
76-
padding: 18px 32px;
77-
border-radius: 0 0 @border-radius-sm @border-radius-sm;
78-
transition: background-color 0.4s;
7976
width: 100%;
8077
font-size: @font-size-base;
78+
border-radius: 0 0 @border-radius-sm @border-radius-sm;
79+
transition: background-color 0.4s;
8180
}
8281

8382
blockquote {
@@ -93,7 +92,7 @@
9392
> p {
9493
font-size: 12px;
9594
margin: 0.5em 0;
96-
padding-right: 25px;
95+
padding: 18px 24px 12px;
9796
width: 100%;
9897
word-break: break-word;
9998
}
@@ -105,28 +104,20 @@
105104
}
106105

107106
.code-expand-icon {
108-
position: absolute;
109-
right: 16px;
110-
bottom: 23px;
111107
cursor: pointer;
112-
width: 16px;
113-
height: 16px;
114-
line-height: 16px;
115-
text-align: center;
116108
}
117109

118110
.code-expand-icon-show,
119111
.code-expand-icon-hide {
120-
transition: all 0.4s;
121-
user-select: none;
122112
position: absolute;
123-
left: 0;
124113
top: 0;
125-
margin: 0;
126-
max-width: 100%;
114+
left: 0;
127115
width: 100%;
128-
vertical-align: baseline;
116+
max-width: 100%;
117+
margin: 0;
129118
box-shadow: none;
119+
transition: all 0.4s;
120+
user-select: none;
130121
}
131122

132123
.code-expand-icon-show {
@@ -169,29 +160,57 @@
169160
}
170161

171162
&-actions {
172-
position: absolute;
173-
top: 10px;
174-
right: 12px;
175-
text-align: right;
163+
padding-top: 12px;
164+
text-align: center;
165+
border-top: 1px dashed @site-border-color-split;
166+
opacity: 0.7;
167+
transition: opacity 0.3s;
168+
169+
&:hover {
170+
opacity: 1;
171+
}
172+
176173
> i,
177-
> form {
174+
> form,
175+
> span {
176+
position: relative;
178177
display: inline-block;
179-
margin-left: 8px;
178+
width: 16px;
179+
height: 16px;
180+
margin-left: 16px;
181+
vertical-align: top;
182+
183+
&:first-child {
184+
margin-left: 0;
185+
}
186+
}
187+
188+
> form {
189+
top: -2px;
180190
}
181191
}
182192

183-
&-code-copy {
184-
font-size: 14px;
185-
cursor: pointer;
193+
&-code-action {
194+
width: 20px;
195+
height: 20px;
186196
color: @site-text-color-secondary;
197+
font-size: 16px;
198+
line-height: 18px;
199+
cursor: pointer;
187200
transition: all 0.24s;
188-
background: #fff;
201+
}
202+
203+
&-code-copy {
189204
width: 20px;
190205
height: 20px;
206+
color: @site-text-color-secondary;
207+
font-size: 14px;
191208
line-height: 20px;
192209
text-align: center;
210+
background: #fff;
193211
border-radius: 20px;
194-
opacity: 0;
212+
cursor: pointer;
213+
transition: all 0.24s;
195214

196215
&:hover {
197216
color: @site-text-color-secondary;

0 commit comments

Comments
 (0)