This repository has been archived by the owner on Oct 20, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ToolBar): add ToolBar for tabs just now
- Loading branch information
Showing
6 changed files
with
116 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,6 @@ const asyncComponent = path => | |
}) | ||
|
||
const WIP = [ | ||
'ToolBar', | ||
'Header', | ||
'Footer', | ||
'SideBar', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/** | ||
* @title 带 Tabs 的 ToolBar | ||
* @renderModel right | ||
*/ | ||
import ToolBar from 'earth-ui/lib/ToolBar' | ||
import notification from 'earth-ui/lib/notification' | ||
import { Tabs, TabList, Tab } from 'earth-ui/lib/Tabs' | ||
|
||
const ToolBarWithTabs = () => { | ||
return ( | ||
<ToolBar> | ||
<Tabs> | ||
<TabList> | ||
<Tab>One</Tab> | ||
<Tab onClick={()=>notification.success('yes')}>Two</Tab> | ||
</TabList> | ||
</Tabs> | ||
</ToolBar> | ||
) | ||
} | ||
|
||
|
||
/** | ||
* @title 动态页签 | ||
* @renderModel right | ||
*/ | ||
import ToolBar from 'earth-ui/lib/ToolBar' | ||
import { Tabs, TabList, Tab } from 'earth-ui/lib/Tabs' | ||
|
||
class TabsDynamic extends Component { | ||
render() { | ||
return ( | ||
<ToolBar> | ||
<Tabs dynamic> | ||
<TabList newTab={{name: `My New Tab`, closeable: true}}> | ||
<Tab key="A" closeable>Closeable One</Tab> | ||
<Tab key="B" closeable>Closeable Two</Tab> | ||
</TabList> | ||
</Tabs> | ||
</ToolBar> | ||
) | ||
} | ||
} | ||
|
||
@component ToolBar | ||
@component Tabs/Tabs | ||
@component Tabs/TabList | ||
@component Tabs/Tab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import cx from 'classnames' | ||
import PropTypes from 'prop-types' | ||
import React from 'react' | ||
import './index.less' | ||
|
||
class ToolBar extends React.Component { | ||
render () { | ||
const { className, children, icon, title, ...other } = this.props | ||
return ( | ||
<div className={cx(`${prefixCls}-toolbar`, className)} {...other}> | ||
<ul className={`${prefixCls}-toolbar__bars`}> | ||
{children && <li>{children}</li>} | ||
</ul> | ||
</div> | ||
) | ||
} | ||
} | ||
|
||
ToolBar.propTypes = { | ||
className: PropTypes.string, | ||
children: PropTypes.node | ||
} | ||
|
||
export default ToolBar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
@import '~ui-variables'; | ||
@import '~ui-mixins'; | ||
|
||
@width: 100%; | ||
@height: @ui-unit-triple; | ||
|
||
.@{prefix-cls}-toolbar { | ||
position: relative; | ||
z-index: @ui-zindex-topbar; | ||
width: 100%; | ||
background-color: @ui-color-white; | ||
border-bottom: 1px solid @ui-color-gray-light; | ||
.ui-mixin-transition(opacity); | ||
&__bars { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters