Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
ant-design-pro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
duanledexianxianxian
ant-design-pro
Commits
b92bcbb1
Commit
b92bcbb1
authored
May 23, 2019
by
陈帅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new copy code style
parent
4d414ea0
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
27 additions
and
24 deletions
+27
-24
scripts/fetch-blocks.js
scripts/fetch-blocks.js
+3
-2
src/components/CopyBlock/index.less
src/components/CopyBlock/index.less
+1
-13
src/components/CopyBlock/index.tsx
src/components/CopyBlock/index.tsx
+10
-9
src/locales/en-US/menu.ts
src/locales/en-US/menu.ts
+3
-0
src/locales/pt-BR/menu.ts
src/locales/pt-BR/menu.ts
+4
-0
src/locales/zh-CN/menu.ts
src/locales/zh-CN/menu.ts
+3
-0
src/locales/zh-TW/menu.ts
src/locales/zh-TW/menu.ts
+3
-0
No files found.
scripts/fetch-blocks.js
View file @
b92bcbb1
...
...
@@ -26,7 +26,7 @@ const findAllInstallRouter = router => {
if
(
item
.
path
!==
'
/user
'
||
item
.
path
!==
'
/
'
)
{
routers
.
push
({
...
item
,
routes
:
''
,
routes
:
!!
item
.
routes
,
});
}
}
...
...
@@ -92,9 +92,10 @@ const installBlock = async () => {
if
(
gitFiles
.
find
(
file
=>
file
.
path
===
gitPath
))
{
console
.
log
(
'
install
'
+
chalk
.
green
(
item
.
name
)
+
'
to:
'
+
chalk
.
yellow
(
item
.
path
));
gitFiles
=
gitFiles
.
filter
(
file
=>
file
.
path
!==
gitPath
);
const
skipModifyRouter
=
item
.
routes
?
'
--skip-modify-routes
'
:
''
;
const
cmd
=
`umi block add https://github.com/ant-design/pro-blocks/tree/master/
${
gitPath
}
--npm-client=cnpm --path=
${
item
.
path
}
`
;
}
${
skipModifyRouter
}
`
;
try
{
await
execCmd
(
cmd
);
console
.
log
(
`install
${
chalk
.
hex
(
'
#1890ff
'
)(
item
.
name
)}
success`
);
...
...
src/components/CopyBlock/index.less
View file @
b92bcbb1
...
...
@@ -2,6 +2,7 @@
position: fixed;
right: 80px;
bottom: 40px;
z-index: 99;
display: flex;
flex-direction: column;
align-items: center;
...
...
@@ -18,24 +19,11 @@
.copy-block-view {
position: relative;
:global {
.ant-typography-copy {
position: absolute;
right: 5px;
bottom: 0;
}
}
.copy-block-code {
display: inline-block;
margin: 0 0.2em;
padding: 0.2em 0.4em 0.1em;
color: #fff;
font-size: 85%;
background: rgba(0, 0, 0, 0.06);
border-radius: 3px;
}
.copy-block-text {
margin: 0;
font-size: 12px;
}
}
src/components/CopyBlock/index.tsx
View file @
b92bcbb1
import
React
from
'
react
'
;
import
{
Icon
,
Typography
,
Tooltip
}
from
'
antd
'
;
import
{
Icon
,
Typography
,
Popover
}
from
'
antd
'
;
import
styles
from
'
./index.less
'
;
const
firstUpperCase
=
(
pathString
:
string
)
=>
{
return
pathString
...
...
@@ -12,15 +12,11 @@ const firstUpperCase = (pathString: string) => {
const
BlockCodeView
:
React
.
SFC
<
{
url
:
string
;
}
>
=
({
url
})
=>
{
console
.
log
(
url
);
const
blockUrl
=
`umi block add https://github.com/ant-design/pro-blocks/tree/master/
${
firstUpperCase
(
url
,
)}
--npm-client=cnpm --path=
${
url
}
`
;
const
blockUrl
=
`npx umi block add ant-design-pro/
${
firstUpperCase
(
url
)}
--path=
${
url
}
`
;
return
(
<
div
className
=
{
styles
[
'
copy-block-view
'
]
}
>
<
p
className
=
{
styles
[
'
copy-block-text
'
]
}
>
下载到项目中:
</
p
>
<
Typography
.
Paragraph
copyable
>
<
div
className
=
{
styles
[
'
copy-block-code
'
]
}
>
{
blockUrl
}
</
div
>
<
code
className
=
{
styles
[
'
copy-block-code
'
]
}
>
{
blockUrl
}
</
code
>
</
Typography
.
Paragraph
>
</
div
>
);
...
...
@@ -28,10 +24,15 @@ const BlockCodeView: React.SFC<{
export
default
({
url
}:
{
url
:
string
})
=>
{
return
(
<
Tooltip
placement
=
"topLeft"
title
=
{
<
BlockCodeView
url
=
{
url
}
/>
}
trigger
=
"click"
>
<
Popover
title
=
"下载此页面到本地项目"
placement
=
"topLeft"
content
=
{
<
BlockCodeView
url
=
{
url
}
/>
}
trigger
=
"click"
>
<
div
className
=
{
styles
[
'
copy-block
'
]
}
>
<
Icon
type
=
"download"
/>
</
div
>
</
Tooltip
>
</
Popover
>
);
};
src/locales/en-US/menu.ts
View file @
b92bcbb1
...
...
@@ -9,6 +9,9 @@ export default {
'
menu.dashboard.analysis
'
:
'
Analysis
'
,
'
menu.dashboard.monitor
'
:
'
Monitor
'
,
'
menu.dashboard.workplace
'
:
'
Workplace
'
,
'
menu.exception.403
'
:
'
403
'
,
'
menu.exception.404
'
:
'
404
'
,
'
menu.exception.500
'
:
'
500
'
,
'
menu.form
'
:
'
Form
'
,
'
menu.form.basic-form
'
:
'
Basic Form
'
,
'
menu.form.step-form
'
:
'
Step Form
'
,
...
...
src/locales/pt-BR/menu.ts
View file @
b92bcbb1
export
default
{
'
menu.welcome
'
:
'
Welcome
'
,
'
menu.more-blocks
'
:
'
More Blocks
'
,
'
menu.home
'
:
'
Início
'
,
'
menu.login
'
:
'
Login
'
,
'
menu.register
'
:
'
Registro
'
,
...
...
@@ -9,6 +10,9 @@ export default {
'
menu.dashboard.analysis
'
:
'
Análise
'
,
'
menu.dashboard.monitor
'
:
'
Monitor
'
,
'
menu.dashboard.workplace
'
:
'
Ambiente de Trabalho
'
,
'
menu.exception.403
'
:
'
403
'
,
'
menu.exception.404
'
:
'
404
'
,
'
menu.exception.500
'
:
'
500
'
,
'
menu.form
'
:
'
Formulário
'
,
'
menu.form.basic-form
'
:
'
Formulário Básico
'
,
'
menu.form.step-form
'
:
'
Formulário Assistido
'
,
...
...
src/locales/zh-CN/menu.ts
View file @
b92bcbb1
...
...
@@ -9,6 +9,9 @@ export default {
'
menu.dashboard.analysis
'
:
'
分析页
'
,
'
menu.dashboard.monitor
'
:
'
监控页
'
,
'
menu.dashboard.workplace
'
:
'
工作台
'
,
'
menu.exception.403
'
:
'
403
'
,
'
menu.exception.404
'
:
'
404
'
,
'
menu.exception.500
'
:
'
500
'
,
'
menu.form
'
:
'
表单页
'
,
'
menu.form.basic-form
'
:
'
基础表单
'
,
'
menu.form.step-form
'
:
'
分步表单
'
,
...
...
src/locales/zh-TW/menu.ts
View file @
b92bcbb1
...
...
@@ -4,6 +4,9 @@ export default {
'
menu.home
'
:
'
首頁
'
,
'
menu.login
'
:
'
登錄
'
,
'
menu.exception.403
'
:
'
403
'
,
'
menu.exception.404
'
:
'
404
'
,
'
menu.exception.500
'
:
'
500
'
,
'
menu.register
'
:
'
註冊
'
,
'
menu.register.resultt
'
:
'
註冊結果
'
,
'
menu.dashboard
'
:
'
Dashboard
'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment