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(Header): rename HeaderBar to Header and add color prop
BREAKING CHANGE: HeaderBar was obsoleted and use Header instead
- Loading branch information
Showing
13 changed files
with
189 additions
and
112 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
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 = [ | ||
'Header', | ||
'Footer', | ||
'SideBar', | ||
'Form', | ||
|
File renamed without changes
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,41 @@ | ||
/** | ||
* @title Header 背景色画廊 | ||
* @renderModel full | ||
*/ | ||
import Header from 'earth-ui/lib/Header' | ||
|
||
const ColorfulHeader = () => { | ||
const colors = [ | ||
'white', | ||
'blue', | ||
'red', | ||
'orange', | ||
'yellow', | ||
'green', | ||
'purple', | ||
'pink', | ||
'gray', | ||
'slate', | ||
'black' | ||
] | ||
const ul = { | ||
// marginTop: -20 | ||
} | ||
const li = { | ||
width: '100%', | ||
listStyle: 'none', | ||
marginBottom: 20 | ||
} | ||
if (window.matchMedia('(min-width:1800px)').matches) { | ||
ul.columnCount = 6 | ||
} | ||
return ( | ||
<ul style={ul}> | ||
{colors.map(color => | ||
<li style={li} key={color}> | ||
<Header icon={`./svg/app_logo_bg_${color === 'blue' ? 'white' : 'blue'}.svg`} title={color} color={color} /> | ||
</li> | ||
)} | ||
</ul> | ||
) | ||
} |
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,25 @@ | ||
/** | ||
* @title 基本功能 | ||
* @renderModel right | ||
*/ | ||
import Header from 'earth-ui/lib/Header' | ||
|
||
const HeaderBasic = () => { | ||
return ( | ||
<Header icon="./svg/app_logo_bg_blue.svg" title="Header" /> | ||
) | ||
} | ||
|
||
/** | ||
* @title 更换背景色 | ||
* @renderModel right | ||
*/ | ||
import Header from 'earth-ui/lib/Header' | ||
|
||
const ColorfulHeader = () => { | ||
return ( | ||
<Header icon="./svg/app_logo_bg_white.svg" title="Header" color="blue" /> | ||
) | ||
} | ||
|
||
@component Header |
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,67 @@ | ||
import cx from 'classnames' | ||
import PropTypes from 'prop-types' | ||
import React from 'react' | ||
import './index.less' | ||
|
||
class Header extends React.Component { | ||
render () { | ||
const { className, children, icon, title, color, ...other } = this.props | ||
return ( | ||
<header | ||
className={cx( | ||
`${prefixCls}-header`, | ||
`${prefixCls}-header--${color}`, | ||
className | ||
)} | ||
{...other} | ||
> | ||
<ul className={`${prefixCls}-header__bars`}> | ||
<li className={`${prefixCls}-header__bars-tool`}> | ||
<menu className={`${prefixCls}-header__bars-tool-item`}> | ||
<li className={`${prefixCls}-header__bars-tool-item-icon`}> | ||
<img src={icon} alt="icon" width={40} height={40} /> | ||
</li> | ||
<li className={`${prefixCls}-header__bars-tool-item-title`}> | ||
<label>{title}</label> | ||
</li> | ||
</menu> | ||
</li> | ||
{children && <li>{children}</li>} | ||
</ul> | ||
</header> | ||
) | ||
} | ||
} | ||
|
||
Header.propTypes = { | ||
className: PropTypes.string, | ||
|
||
children: PropTypes.node, | ||
|
||
// Header 左侧的 icon | ||
icon: PropTypes.string, | ||
|
||
// Header 标题 | ||
title: PropTypes.string, | ||
|
||
// Header 背景色,默认 white | ||
color: PropTypes.oneOf([ | ||
'blue', | ||
'red', | ||
'orange', | ||
'yellow', | ||
'green', | ||
'purple', | ||
'pink', | ||
'gray', | ||
'slate', | ||
'black', | ||
'white' | ||
]) | ||
} | ||
|
||
Header.defaultProps = { | ||
color: 'white' | ||
} | ||
|
||
export default Header |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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