Created
August 1, 2016 10:11
-
-
Save OlavHN/2b63fcca1ec2b883c89d9975a76d69c3 to your computer and use it in GitHub Desktop.
Inject tabs template
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
import React, {Component, PropTypes} from 'react'; | |
import {Tabs, Tab} from 'material-ui/Tabs'; | |
class MyAwesomeTabTemplate extends Component { | |
static propTypes = { | |
children: PropTypes.node, | |
selected: PropTypes.bool, | |
}; | |
render() { | |
const styles = { | |
width: '100%', | |
position: 'relative', | |
textAlign: 'initial', | |
fontWeight: 'bold', // <-- LOOK HERE | |
}; | |
if (!this.props.selected) { | |
styles.fontWeight: 'normal', // <-- AND HERE! | |
styles.height = 0; | |
styles.overflow = 'hidden'; | |
} | |
return ( | |
<div style={styles}> | |
{this.props.children} | |
</div> | |
); | |
} | |
} | |
export default ( | |
<Tabs | |
tabTemplate={MyAwesomeTabTemplate}> | |
<Tab label="Hello" /> | |
<Tab label="World" /> | |
</Tabs> | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment