Skip to content

Commit

Permalink
Merge pull request #1022 from cozy/feat/AppTitle
Browse files Browse the repository at this point in the history
feat: Add AppTitle component
  • Loading branch information
GoOz authored Jun 4, 2019
2 parents 28d3169 + 5cd29f8 commit 36e8530
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/styleguide.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ module.exports = {
'../react/Well/index.jsx',
'../react/Infos/index.jsx',
'../react/ContextHeader/index.jsx',
'../react/Filename/index.jsx'
'../react/Filename/index.jsx',
'../react/AppTitle/index.jsx'
]
},
{
Expand Down
8 changes: 8 additions & 0 deletions react/AppTitle/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Displays the App title in the Cozy Bar

### Default

```
<AppTitle>Drive</AppTitle>
```

27 changes: 27 additions & 0 deletions react/AppTitle/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React from 'react'
import cx from 'classnames'
import { MainTitle } from '../Text'
import PropTypes from 'prop-types'
import styles from './styles.styl'

export const AppTitle = ({ children, className, ...restProps }) => {
return (
<MainTitle
tag="h1"
className={cx(styles['c-apptitle'], className)}
{...restProps}
>
{children}
</MainTitle>
)
}

AppTitle.propTypes = {
className: PropTypes.string
}

AppTitle.defaultProps = {
className: ''
}

export default AppTitle
5 changes: 5 additions & 0 deletions react/AppTitle/styles.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@require '../../stylus/components/apptitle'

.c-apptitle
@extend $apptitle

6 changes: 6 additions & 0 deletions react/__snapshots__/examples.spec.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ exports[`ActionMenu should render examples: ActionMenu 2`] = `
</div>"
`;

exports[`AppTitle should render examples: AppTitle 1`] = `
"<div>
<h1 class=\\"styles__u-title-h1___fimho styles__c-apptitle___eqV9l\\">Drive</h1>
</div>"
`;
exports[`Avatar should render examples: Avatar 1`] = `
"<div>
<div class=\\"styles__c-avatar___PpDI-\\"><svg class=\\"styles__icon___23x3R\\" width=\\"16\\" height=\\"16\\">
Expand Down
1 change: 1 addition & 0 deletions react/examples.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ testComponent('MuiCozyTheme/Buttons')
testComponent('MuiCozyTheme/Menus')
testComponent('MuiCozyTheme/ExpansionPanel')
testComponent('ActionMenu')
testComponent('AppTitle')
testComponent('Avatar')
testComponent('Badge')
testComponent('BarButton')
Expand Down
1 change: 1 addition & 0 deletions react/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export { default as Counter } from './Counter'
export { default as Well } from './Well'
export { default as Infos } from './Infos'
export { default as AppIcon } from './AppIcon'
export { default as AppTitle } from './AppTitle'
export { default as Filename } from './Filename'
export { default as Viewer } from './Viewer/ViewerExposer'
export { default as FileInput } from './FileInput'
3 changes: 3 additions & 0 deletions react/testFromStyleguidist.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import pretty from 'pretty'
*/
import ActionMenu from './ActionMenu'
import Alerter from './Alerter'
import AppTitle from './AppTitle'
import Avatar from './Avatar'
import Badge from './Badge'
import BarButton from './BarButton'
Expand Down Expand Up @@ -69,6 +70,7 @@ const testFromStyleguidist = (name, markdown, require) => {
'content',
'ActionMenu',
'Alerter',
'AppTitle',
'Avatar',
'Badge',
'BarButton',
Expand Down Expand Up @@ -117,6 +119,7 @@ const testFromStyleguidist = (name, markdown, require) => {
content,
ActionMenu,
Alerter,
AppTitle,
Avatar,
Badge,
BarButton,
Expand Down
5 changes: 5 additions & 0 deletions stylus/components/apptitle.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
$apptitle
display inline-flex
align-items center
margin 0

0 comments on commit 36e8530

Please sign in to comment.