-
Notifications
You must be signed in to change notification settings - Fork 10
Add header to SlidingPanel component #137
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
const SlidingPanelHeader = ({ title }) => { | ||
if (!title) { | ||
return <noscript />; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. afaik could be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @asci it is only available on React 15: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I forget every time:D When we'll migrate? |
||
} | ||
|
||
return ( | ||
<div className="ui-sliding-panel-header"> | ||
<h3 className="ui-sliding-panel-header__title"> | ||
{title} | ||
</h3> | ||
<button | ||
className="ui-sliding-panel-header__close-button" | ||
rel="close" | ||
> | ||
× | ||
</button> | ||
</div> | ||
); | ||
}; | ||
|
||
SlidingPanelHeader.propTypes = { | ||
title: PropTypes.string.isRequired, | ||
}; | ||
|
||
export default SlidingPanelHeader; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
.ui-sliding-panel-header { | ||
background-color: var(--tx-generic-color-blank); | ||
border-bottom: solid 2px var(--tx-generic-color-secondary-darker); | ||
flex-shrink: 0; | ||
height: 65px; | ||
min-height: 65px; | ||
text-align: center; | ||
} | ||
|
||
.ui-sliding-panel-header__title { | ||
line-height: 65px; | ||
margin: 0; | ||
padding: 0 50px; | ||
} | ||
|
||
.ui-sliding-panel-header__close-button { | ||
background: none; | ||
border: none; | ||
box-shadow: none; | ||
color: var(--tx-generic-color-secondary-darker); | ||
cursor: pointer; | ||
font-size: 40px; | ||
height: 25px; | ||
line-height: 25px; | ||
overflow: visible; | ||
padding: 0; | ||
position: absolute; | ||
right: var(--tx-sliding-panel-panel-padding); | ||
text-align: right; | ||
top: 16px; | ||
width: 20px; | ||
|
||
&:hover { | ||
color: var(--tx-generic-color-secondary-darkest); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`SlidingPanel #render() do not render without title 1`] = ` | ||
<SlidingPanelHeader> | ||
<noscript /> | ||
</SlidingPanelHeader> | ||
`; | ||
|
||
exports[`SlidingPanel #render() render with title 1`] = ` | ||
<SlidingPanelHeader | ||
title="Test Title" | ||
> | ||
<div | ||
className="ui-sliding-panel-header" | ||
> | ||
<h3 | ||
className="ui-sliding-panel-header__title" | ||
> | ||
Test Title | ||
</h3> | ||
<button | ||
className="ui-sliding-panel-header__close-button" | ||
rel="close" | ||
> | ||
× | ||
</button> | ||
</div> | ||
</SlidingPanelHeader> | ||
`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍