Commit b92bcbb1 authored by 陈帅's avatar 陈帅

new copy code style

parent 4d414ea0
......@@ -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`);
......
......@@ -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;
}
}
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>
);
};
......@@ -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',
......
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',
......
......@@ -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': '分步表单',
......
......@@ -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',
......
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