Commit b92bcbb1 authored by 陈帅's avatar 陈帅

new copy code style

parent 4d414ea0
...@@ -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`);
......
...@@ -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;
}
} }
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>
); );
}; };
...@@ -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',
......
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',
......
...@@ -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': '分步表单',
......
...@@ -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',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment