Skip to content

Instantly share code, notes, and snippets.

@OlavHN
Created August 1, 2016 10:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OlavHN/2b63fcca1ec2b883c89d9975a76d69c3 to your computer and use it in GitHub Desktop.
Save OlavHN/2b63fcca1ec2b883c89d9975a76d69c3 to your computer and use it in GitHub Desktop.
Inject tabs template
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