diff --git a/components/tab/demo/basic.md b/components/tab/demo/basic.md index 21a657a6f7..4a1973bbae 100644 --- a/components/tab/demo/basic.md +++ b/components/tab/demo/basic.md @@ -7,7 +7,7 @@ --- ````jsx -var Tabs = antd.tab; +var Tabs = antd.Tab; var TabPane = Tabs.TabPane; function callback() {} diff --git a/style/components/tab.less b/style/components/tab.less index e69de29bb2..53da3a9251 100644 --- a/style/components/tab.less +++ b/style/components/tab.less @@ -0,0 +1,234 @@ +// index.less + +@prefixClass: rc-tabs; +@easing-in-out: cubic-bezier(0.35, 0, 0.25, 1); + +@effect-duration: .5s; + +.@{prefixClass} { + outline: none; + box-sizing: border-box; + border-bottom: 2px solid #f3f3f3; + position: relative; + + @font-face { + font-family: 'iconfont'; + src: url('//at.alicdn.com/t/font_1429685559_5814753.eot'); + /* IE9*/ + src: url('//at.alicdn.com/t/font_1429685559_5814753.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ url('//at.alicdn.com/t/font_1429685559_5814753.woff') format('woff'), /* chrome、firefox */ url('//at.alicdn.com/t/font_1429685559_5814753.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/ url('//at.alicdn.com/t/font_1429685559_5814753.svg#iconfont') format('svg'); + /* iOS 4.1- */ + } + + &-ink-bar { + z-index: 1; + position: absolute; + left: 0; + bottom: 0px; + box-sizing: border-box; + height: 4px; + margin-top: -3px; + background-color: #3fc7fa; + transform: scaleX(1); + transform-origin: 0 0; + &-transition-right { + transition: right 0.3s @easing-in-out, + left 0.3s @easing-in-out 0.3s * 0.3; + } + &-transition-left { + transition: right 0.3s @easing-in-out 0.3s * 0.3, + left 0.3s @easing-in-out; + } + } + + &-nav-container { + font-size: 14px; + line-height: 1.5; + box-sizing: border-box; + width: 100%; + overflow: hidden; + position: relative; + white-space: nowrap; + padding-left: 32px; + padding-right: 32px; + border-bottom: 2px solid #f3f3f3; + } + + &-tab-prev, &-tab-next { + user-select: none; + -webkit-user-select: none; + z-index: 1; + margin-right: -2px; + width: 32px; + height: 100%; + line-height: 36px; + cursor: pointer; + border: none; + background-color: transparent; + position: absolute; + + &-icon { + position: relative; + display: inline-block; + font-style: normal; + font-weight: normal; + font-variant: normal; + line-height: inherit; + vertical-align: baseline; + text-align: center; + text-transform: none; + -webkit-font-smoothing: antialiased; + -webkit-text-stroke-width: 0px; + -moz-osx-font-smoothing: grayscale; + font-family: sans-serif; + + &:before { + display: block; + font-family: "iconfont" !important; + } + } + } + + &-tab-next { + right: 2px; + + &-icon:before { + content: "\e651"; + } + } + + &-tab-prev { + left: 0; + transform: rotate(180deg); + filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2); + &-icon:before { + content: "\e651"; + } + } + + &-nav-wrap { + width: 100%; + overflow: hidden; + } + + &-nav-scroll { + width:99999px; + } + + &-nav { + height: 36px; + box-sizing: border-box; + padding-left: 0; + transition: left 0.5s @easing-in-out; + position: relative; + margin: 0; + list-style: none; + display: inline-block; + + &:before, &:after { + display: table; + content: " "; + } + + &:after { + clear: both; + } + + div.@{prefixClass}-tab-active { + + > a, > a:hover, > a:focus { + color: #3fc7fa; + cursor: default; + text-decoration: none; + } + } + + div.@{prefixClass}-tab-disabled { + pointer-events: none; + cursor: default; + color: #ccc; + } + + .@{prefixClass}-tab { + float: left; + height: 100%; + padding: 10px 20px; + margin-right: 30px; + box-sizing: border-box; + position: relative; + display: block; + + > a { + transition: color 0.3s @easing-in-out; + margin-bottom: 4px; + font-weight: 500; + display: inline-block; + } + + > a:hover { + color: #23c0fa; + cursor: pointer; + } + + > a:hover, > a:focus { + text-decoration: none; + } + } + } + + &-tabpane-hidden { + display: none; + } + + &-content { + position: relative; + width: 100%; + overflow: hidden; + } + + &-effect-left-enter { + transform: translateX(-100%); + + } + + &-effect-left-enter&-effect-left-enter-active { + transform: translateX(0); + transition: transform @effect-duration @easing-in-out; + } + + &-effect-left-leave { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + transform: translateX(0); + } + + &-effect-left-leave&-effect-left-leave-active { + transform: translateX(100%); + transition: transform @effect-duration @easing-in-out; + } + + &-effect-right-enter { + transform: translateX(100%); + } + + &-effect-right-enter&-effect-right-enter-active { + transform: translateX(0); + transition: transform @effect-duration @easing-in-out; + } + + &-effect-right-leave { + position: absolute; + transform: translateX(0); + top: 0; + right: 0; + left: 0; + bottom: 0; + } + + &-effect-right-leave&-effect-right-leave-active { + transform: translateX(-100%); + transition: transform @effect-duration @easing-in-out; + } +}