From ced4dcb9916822edf804deb2115853e628ac4b67 Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 1 Jul 2015 21:24:04 +0800 Subject: [PATCH] update breadcrumb demo --- components/breadcrumb/demo/basic.md | 7 ++++--- components/breadcrumb/demo/withIcon.md | 27 ++++++++++++++++++++++++++ components/breadcrumb/index.jsx | 15 +++++++------- style/components/breadcrumb.less | 10 ++++++++++ style/mixins/iconfont.less | 6 +----- 5 files changed, 50 insertions(+), 15 deletions(-) create mode 100644 components/breadcrumb/demo/withIcon.md diff --git a/components/breadcrumb/demo/basic.md b/components/breadcrumb/demo/basic.md index 1aea2151e8..0a9a8a7940 100644 --- a/components/breadcrumb/demo/basic.md +++ b/components/breadcrumb/demo/basic.md @@ -2,7 +2,7 @@ - order: 0 -最简单的用法。 +最简单的用法,存在 `href` 表示可点。 --- @@ -11,9 +11,10 @@ var Breadcrumb = antd.Breadcrumb; React.render( - 首页 + 首页 + 应用中心 应用列表 - 应用 + 某应用 , document.getElementById('components-breadcrumb-demo-basic')); ```` diff --git a/components/breadcrumb/demo/withIcon.md b/components/breadcrumb/demo/withIcon.md new file mode 100644 index 0000000000..b2c9d919eb --- /dev/null +++ b/components/breadcrumb/demo/withIcon.md @@ -0,0 +1,27 @@ +# 带有图标的 + +- order: 1 + +图标放在文字前面。 + +--- + +````jsx +var Breadcrumb = antd.Breadcrumb; + +React.render( + + + + + + + 应用列表 + + + 应用 + + +, document.getElementById('components-breadcrumb-demo-withicon')); +```` + diff --git a/components/breadcrumb/index.jsx b/components/breadcrumb/index.jsx index 627aec47fc..0b25873c2e 100644 --- a/components/breadcrumb/index.jsx +++ b/components/breadcrumb/index.jsx @@ -9,20 +9,21 @@ let BreadcrumbItem = React.createClass({ var link = {this.props.children}; var slash = /; if (typeof this.props.href === 'undefined') { - slash = ''; link = {this.props.children}; } - return ( - - {link} - {slash} - - ); + if (this.props.last) { + slash = ''; + } + return {link} {slash}; } }); let Breadcrumb = React.createClass({ render() { + if (this.props.children.length > 0) { + var last = this.props.children[this.props.children.length - 1]; + last.props.last = true; + } return (
{this.props.children} diff --git a/style/components/breadcrumb.less b/style/components/breadcrumb.less index 998f8b30e1..166d6f998e 100644 --- a/style/components/breadcrumb.less +++ b/style/components/breadcrumb.less @@ -17,4 +17,14 @@ margin: 0 8px; color: #d9d9d9; } + + .anticon { + font-size: 14px; + position: relative; + top: -1px; + } + + .anticon + span { + margin-left: 6px; + } } diff --git a/style/mixins/iconfont.less b/style/mixins/iconfont.less index cbd64bef82..b1f60c408a 100644 --- a/style/mixins/iconfont.less +++ b/style/mixins/iconfont.less @@ -6,13 +6,9 @@ text-align: center; text-transform: none; text-rendering: auto; - // 更好地渲染字体 - -webkit-font-smoothing: antialiased; - -webkit-text-stroke-width: 0px; - -moz-osx-font-smoothing: grayscale; &:before { display: block; font-family: "anticon" !important; } -} \ No newline at end of file +}