From 26ec81611f22783a8abbcc3a1c05dc36a0adf73b Mon Sep 17 00:00:00 2001 From: Benjy Cui Date: Fri, 4 Mar 2016 09:55:03 +0800 Subject: [PATCH] chore: update motion.md && colors.md --- docs/spec/colors.md | 32 +++++++++++++++++--------------- docs/spec/motion.md | 27 +++++++++++++-------------- scripts/build-common.js | 2 +- site/component/utils.js | 3 +-- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/docs/spec/colors.md b/docs/spec/colors.md index c05e0e28b9..7e1277ec57 100644 --- a/docs/spec/colors.md +++ b/docs/spec/colors.md @@ -15,9 +15,9 @@ Ant Design 的色板由 9 种基本色彩组成,每种基本色又衍生出九宫格色板,在此基础上还可以通过黑白叠加的方式实现色彩明暗的效果。 `````__react -let Palette = React.createClass({ +const Palette = React.createClass({ render() { - let color = this.props.color; + const color = this.props.color; return
{color.colors.map(function(color) { @@ -31,9 +31,9 @@ let Palette = React.createClass({
; } }); -let ExtendPalettes = React.createClass({ +const ExtendPalettes = React.createClass({ render() { - let colors = [ + const colors = [ { 'title': 'Primary Color', 'description': '尽管同一种颜色传达的含义会因人而异,受到文化和地域的影响。但颜色还是可以提取出一些共通的特性,例如暖色系的红、橙、黄通常用于象征活力,激情,积极;而冷色系的绿、蓝、紫通常给人感觉是安全、稳定、专业。', @@ -132,7 +132,7 @@ let ExtendPalettes = React.createClass({
; } }); -ReactDOM.render(, mountNode); +ReactDOM.render(, mountNode); ````` ## 色彩和交互 @@ -156,11 +156,13 @@ ReactDOM.render(, mountNode); > 正数为变淡 `tint` ,负数为加深 `shade`。 `````__react -let Button = antd.Button; -let InputNumber = antd.InputNumber; -let Slider = antd.Slider; -let Tooltip = antd.Tooltip; -let TintShadeTool = React.createClass({ +const Values = require('values.js'); +const CopyToClipboard = require('react-copy-to-clipboard'); +const Button = antd.Button; +const InputNumber = antd.InputNumber; +const Slider = antd.Slider; +const Tooltip = antd.Tooltip; +const TintShadeTool = React.createClass({ getInitialState() { return { result: '#2db7f5', @@ -190,9 +192,9 @@ let TintShadeTool = React.createClass({ }); return; } - let tintOrShade = this.state.value > 0 ? 'tint' : 'shade'; - let c = new Values(this.state.color); - let resultColor = c[tintOrShade](Math.abs(this.state.value)); + const tintOrShade = this.state.value > 0 ? 'tint' : 'shade'; + const c = new Values(this.state.color); + const resultColor = c[tintOrShade](Math.abs(this.state.value)); this.setState({ result: '#' + resultColor.hex, darkBackground: resultColor.getBrightness() < 50 @@ -206,7 +208,7 @@ let TintShadeTool = React.createClass({ }); }, render() { - var marks = { + const marks = { '-100': '加黑', '0': '原色', '100': '加白' @@ -230,7 +232,7 @@ let TintShadeTool = React.createClass({ } }); -ReactDOM.render(, mountNode); +ReactDOM.render(, mountNode); ````` Ant Design 专用色彩换算工具,用于解析类似 `#2db7f5 tint 80%` 的色彩标注。 diff --git a/docs/spec/motion.md b/docs/spec/motion.md index 69b685d2ab..f94014f62e 100644 --- a/docs/spec/motion.md +++ b/docs/spec/motion.md @@ -9,13 +9,13 @@ Ant Design 提供了一些预设的组件动画样式。 `````__react -var cssAnimation = require('css-animation'); -var Select = antd.Select; -var Option = Select.Option; -var OptGroup = Select.OptGroup; +const cssAnimation = require('css-animation'); +const Select = antd.Select; +const Option = Select.Option; +const OptGroup = Select.OptGroup; -var motions = []; +let motions = []; motions = motions.concat([[{ name: '淡入', value: 'fade', @@ -166,10 +166,10 @@ motions = motions.concat([[{ direction: 'enter', type: '其他' }]]); -var leave='-leave'; -var Test = React.createClass({ +const leave='-leave'; +const Test = React.createClass({ handleChange(e) { - var value = e; + const value = e; if(value){ this.demoNode.style.visibility=''; cssAnimation(this.demoNode, value, () => { @@ -185,11 +185,11 @@ var Test = React.createClass({ }, render() { - var options = [].concat(motions.map(function (m) { - var opts = m.map(function (m2) { - return + const options = [].concat(motions.map(function (m, groupIndex) { + const opts = m.map(function (m2, optIndex) { + return }); - return {opts}; + return {opts}; })); return
@@ -198,12 +198,11 @@ var Test = React.createClass({
-
; } }); -ReactDOM.render(, mountNode); +ReactDOM.render(, mountNode); ````` ## 组件动画 diff --git a/scripts/build-common.js b/scripts/build-common.js index 58eb3aefa8..b65147d975 100644 --- a/scripts/build-common.js +++ b/scripts/build-common.js @@ -27,7 +27,7 @@ const parse = function parse(fileName) { const description = R.map( (node) => { if (node.type === 'code' && node.props.lang === '__react') { - return devil(node.children, ['React', 'antd', 'CopyToClipboard']); + return devil(node.children, ['React', 'antd']); } return node; }, diff --git a/site/component/utils.js b/site/component/utils.js index 81236528cc..f25866040e 100644 --- a/site/component/utils.js +++ b/site/component/utils.js @@ -1,6 +1,5 @@ import React from 'react'; import hljs from 'highlight.js'; -import CopyToClipboard from 'react-copy-to-clipboard'; import antd, { Menu } from '../../'; function isHeading(type) { @@ -15,7 +14,7 @@ export function objectToComponent(object, index) { } if (typeof object === 'function') { - return object(React, antd, CopyToClipboard); + return object(React, antd); } if (typeof object === 'string') {