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 => {
...
@@ -26,7 +26,7 @@ const findAllInstallRouter = router => {
if
(
item
.
path
!==
'
/user
'
||
item
.
path
!==
'
/
'
)
{
if
(
item
.
path
!==
'
/user
'
||
item
.
path
!==
'
/
'
)
{
routers
.
push
({
routers
.
push
({
...
item
,
...
item
,
routes
:
''
,
routes
:
!!
item
.
routes
,
});
});
}
}
}
}
...
@@ -92,9 +92,10 @@ const installBlock = async () => {
...
@@ -92,9 +92,10 @@ const installBlock = async () => {
if
(
gitFiles
.
find
(
file
=>
file
.
path
===
gitPath
))
{
if
(
gitFiles
.
find
(
file
=>
file
.
path
===
gitPath
))
{
console
.
log
(
'
install
'
+
chalk
.
green
(
item
.
name
)
+
'
to:
'
+
chalk
.
yellow
(
item
.
path
));
console
.
log
(
'
install
'
+
chalk
.
green
(
item
.
name
)
+
'
to:
'
+
chalk
.
yellow
(
item
.
path
));
gitFiles
=
gitFiles
.
filter
(
file
=>
file
.
path
!==
gitPath
);
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=
${
const
cmd
=
`umi block add https://github.com/ant-design/pro-blocks/tree/master/
${
gitPath
}
--npm-client=cnpm --path=
${
item
.
path
item
.
path
}
`
;
}
${
skipModifyRouter
}
`
;
try
{
try
{
await
execCmd
(
cmd
);
await
execCmd
(
cmd
);
console
.
log
(
`install
${
chalk
.
hex
(
'
#1890ff
'
)(
item
.
name
)}
success`
);
console
.
log
(
`install
${
chalk
.
hex
(
'
#1890ff
'
)(
item
.
name
)}
success`
);
...
...
src/components/CopyBlock/index.less
View file @
b92bcbb1
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
position: fixed;
position: fixed;
right: 80px;
right: 80px;
bottom: 40px;
bottom: 40px;
z-index: 99;
display: flex;
display: flex;
flex-direction: column;
flex-direction: column;
align-items: center;
align-items: center;
...
@@ -18,24 +19,11 @@
...
@@ -18,24 +19,11 @@
.copy-block-view {
.copy-block-view {
position: relative;
position: relative;
:global {
.ant-typography-copy {
position: absolute;
right: 5px;
bottom: 0;
}
}
.copy-block-code {
.copy-block-code {
display: inline-block;
display: inline-block;
margin: 0 0.2em;
margin: 0 0.2em;
padding: 0.2em 0.4em 0.1em;
padding: 0.2em 0.4em 0.1em;
color: #fff;
font-size: 85%;
font-size: 85%;
background: rgba(0, 0, 0, 0.06);
border-radius: 3px;
border-radius: 3px;
}
}
.copy-block-text {
margin: 0;
font-size: 12px;
}
}
}
src/components/CopyBlock/index.tsx
View file @
b92bcbb1
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
{
Icon
,
Typography
,
Tooltip
}
from
'
antd
'
;
import
{
Icon
,
Typography
,
Popover
}
from
'
antd
'
;
import
styles
from
'
./index.less
'
;
import
styles
from
'
./index.less
'
;
const
firstUpperCase
=
(
pathString
:
string
)
=>
{
const
firstUpperCase
=
(
pathString
:
string
)
=>
{
return
pathString
return
pathString
...
@@ -12,15 +12,11 @@ const firstUpperCase = (pathString: string) => {
...
@@ -12,15 +12,11 @@ const firstUpperCase = (pathString: string) => {
const
BlockCodeView
:
React
.
SFC
<
{
const
BlockCodeView
:
React
.
SFC
<
{
url
:
string
;
url
:
string
;
}
>
=
({
url
})
=>
{
}
>
=
({
url
})
=>
{
console
.
log
(
url
);
const
blockUrl
=
`npx umi block add ant-design-pro/
${
firstUpperCase
(
url
)}
--path=
${
url
}
`
;
const
blockUrl
=
`umi block add https://github.com/ant-design/pro-blocks/tree/master/
${
firstUpperCase
(
url
,
)}
--npm-client=cnpm --path=
${
url
}
`
;
return
(
return
(
<
div
className
=
{
styles
[
'
copy-block-view
'
]
}
>
<
div
className
=
{
styles
[
'
copy-block-view
'
]
}
>
<
p
className
=
{
styles
[
'
copy-block-text
'
]
}
>
下载到项目中:
</
p
>
<
Typography
.
Paragraph
copyable
>
<
Typography
.
Paragraph
copyable
>
<
div
className
=
{
styles
[
'
copy-block-code
'
]
}
>
{
blockUrl
}
</
div
>
<
code
className
=
{
styles
[
'
copy-block-code
'
]
}
>
{
blockUrl
}
</
code
>
</
Typography
.
Paragraph
>
</
Typography
.
Paragraph
>
</
div
>
</
div
>
);
);
...
@@ -28,10 +24,15 @@ const BlockCodeView: React.SFC<{
...
@@ -28,10 +24,15 @@ const BlockCodeView: React.SFC<{
export
default
({
url
}:
{
url
:
string
})
=>
{
export
default
({
url
}:
{
url
:
string
})
=>
{
return
(
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
'
]
}
>
<
div
className
=
{
styles
[
'
copy-block
'
]
}
>
<
Icon
type
=
"download"
/>
<
Icon
type
=
"download"
/>
</
div
>
</
div
>
</
Tooltip
>
</
Popover
>
);
);
};
};
src/locales/en-US/menu.ts
View file @
b92bcbb1
...
@@ -9,6 +9,9 @@ export default {
...
@@ -9,6 +9,9 @@ export default {
'
menu.dashboard.analysis
'
:
'
Analysis
'
,
'
menu.dashboard.analysis
'
:
'
Analysis
'
,
'
menu.dashboard.monitor
'
:
'
Monitor
'
,
'
menu.dashboard.monitor
'
:
'
Monitor
'
,
'
menu.dashboard.workplace
'
:
'
Workplace
'
,
'
menu.dashboard.workplace
'
:
'
Workplace
'
,
'
menu.exception.403
'
:
'
403
'
,
'
menu.exception.404
'
:
'
404
'
,
'
menu.exception.500
'
:
'
500
'
,
'
menu.form
'
:
'
Form
'
,
'
menu.form
'
:
'
Form
'
,
'
menu.form.basic-form
'
:
'
Basic Form
'
,
'
menu.form.basic-form
'
:
'
Basic Form
'
,
'
menu.form.step-form
'
:
'
Step Form
'
,
'
menu.form.step-form
'
:
'
Step Form
'
,
...
...
src/locales/pt-BR/menu.ts
View file @
b92bcbb1
export
default
{
export
default
{
'
menu.welcome
'
:
'
Welcome
'
,
'
menu.welcome
'
:
'
Welcome
'
,
'
menu.more-blocks
'
:
'
More Blocks
'
,
'
menu.more-blocks
'
:
'
More Blocks
'
,
'
menu.home
'
:
'
Início
'
,
'
menu.home
'
:
'
Início
'
,
'
menu.login
'
:
'
Login
'
,
'
menu.login
'
:
'
Login
'
,
'
menu.register
'
:
'
Registro
'
,
'
menu.register
'
:
'
Registro
'
,
...
@@ -9,6 +10,9 @@ export default {
...
@@ -9,6 +10,9 @@ export default {
'
menu.dashboard.analysis
'
:
'
Análise
'
,
'
menu.dashboard.analysis
'
:
'
Análise
'
,
'
menu.dashboard.monitor
'
:
'
Monitor
'
,
'
menu.dashboard.monitor
'
:
'
Monitor
'
,
'
menu.dashboard.workplace
'
:
'
Ambiente de Trabalho
'
,
'
menu.dashboard.workplace
'
:
'
Ambiente de Trabalho
'
,
'
menu.exception.403
'
:
'
403
'
,
'
menu.exception.404
'
:
'
404
'
,
'
menu.exception.500
'
:
'
500
'
,
'
menu.form
'
:
'
Formulário
'
,
'
menu.form
'
:
'
Formulário
'
,
'
menu.form.basic-form
'
:
'
Formulário Básico
'
,
'
menu.form.basic-form
'
:
'
Formulário Básico
'
,
'
menu.form.step-form
'
:
'
Formulário Assistido
'
,
'
menu.form.step-form
'
:
'
Formulário Assistido
'
,
...
...
src/locales/zh-CN/menu.ts
View file @
b92bcbb1
...
@@ -9,6 +9,9 @@ export default {
...
@@ -9,6 +9,9 @@ export default {
'
menu.dashboard.analysis
'
:
'
分析页
'
,
'
menu.dashboard.analysis
'
:
'
分析页
'
,
'
menu.dashboard.monitor
'
:
'
监控页
'
,
'
menu.dashboard.monitor
'
:
'
监控页
'
,
'
menu.dashboard.workplace
'
:
'
工作台
'
,
'
menu.dashboard.workplace
'
:
'
工作台
'
,
'
menu.exception.403
'
:
'
403
'
,
'
menu.exception.404
'
:
'
404
'
,
'
menu.exception.500
'
:
'
500
'
,
'
menu.form
'
:
'
表单页
'
,
'
menu.form
'
:
'
表单页
'
,
'
menu.form.basic-form
'
:
'
基础表单
'
,
'
menu.form.basic-form
'
:
'
基础表单
'
,
'
menu.form.step-form
'
:
'
分步表单
'
,
'
menu.form.step-form
'
:
'
分步表单
'
,
...
...
src/locales/zh-TW/menu.ts
View file @
b92bcbb1
...
@@ -4,6 +4,9 @@ export default {
...
@@ -4,6 +4,9 @@ export default {
'
menu.home
'
:
'
首頁
'
,
'
menu.home
'
:
'
首頁
'
,
'
menu.login
'
:
'
登錄
'
,
'
menu.login
'
:
'
登錄
'
,
'
menu.exception.403
'
:
'
403
'
,
'
menu.exception.404
'
:
'
404
'
,
'
menu.exception.500
'
:
'
500
'
,
'
menu.register
'
:
'
註冊
'
,
'
menu.register
'
:
'
註冊
'
,
'
menu.register.resultt
'
:
'
註冊結果
'
,
'
menu.register.resultt
'
:
'
註冊結果
'
,
'
menu.dashboard
'
:
'
Dashboard
'
,
'
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