-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
jz/gt - add feature banner to react-gears
- Loading branch information
Showing
5 changed files
with
84 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import React from 'react'; | ||
import { Alert } from '../'; | ||
import styles from './FeatureBanner.scss'; | ||
|
||
export default class FeatureBanner extends React.Component { | ||
static propTypes = { | ||
alertText: React.PropTypes.string, | ||
className: React.PropTypes.string, | ||
children: React.PropTypes.object, | ||
subtitle: React.PropTypes.string.isRequired, | ||
title: React.PropTypes.string.isRequired, | ||
}; | ||
|
||
static defaultProps = { | ||
alertText: 'new', | ||
}; | ||
|
||
render() { | ||
const { alertText, title, subtitle, children } = this.props; | ||
const alertStyle = `${styles.alert} font-weight-bold text-uppercase`; | ||
|
||
return ( | ||
<div> | ||
<Alert color="info" className="align-items-center d-flex flex-wrap"> | ||
<div className={`${alertStyle} pr-3 hidden-sm-down`}> | ||
{alertText} | ||
</div> | ||
<div className={`${styles.body} d-flex align-items-around justify-content-start mr-auto`}> | ||
<div className={`${styles.info}`}> | ||
<p className="d-inline-block font-weight-bold m-0"> | ||
<span className={`${alertStyle} hidden-md-up mr-1`}>{alertText}</span> | ||
{title} | ||
</p> | ||
<p className="m-0">{subtitle}</p> | ||
</div> | ||
</div> | ||
<div className="d-flex"> | ||
{children} | ||
</div> | ||
</Alert> | ||
</div> | ||
) | ||
} | ||
} |
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,15 @@ | ||
.body { | ||
@media (min-width: 768px) { | ||
border-left: 1px solid #dae4f1; | ||
padding-left: 13px; | ||
} | ||
flex-direction: row; | ||
} | ||
|
||
.info { | ||
flex: 1 1 auto; | ||
} | ||
|
||
.alert { | ||
font-size: 18px; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import React from 'react'; | ||
import { Button, FeatureBanner } from '../src'; | ||
import { storiesOf } from '@kadira/storybook'; | ||
import { text } from '@kadira/storybook-addon-knobs'; | ||
|
||
storiesOf('FeatureBanner', module) | ||
.addWithInfo('Live example', () => { | ||
const button = ( | ||
<Button className="mr-1 mt-1" color="primary" outline disabled={false}> | ||
Click Me | ||
</Button> | ||
); | ||
const children = [button, button]; | ||
const subtitle = text('subtitle', 'View all text messages sent by your company from this page.'); | ||
return ( | ||
<FeatureBanner | ||
title="Company-Wide View of Text Messages" | ||
subtitle={subtitle} | ||
children={children} | ||
/> | ||
); | ||
}); |
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