-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[docs] Add a demo with Font Awesome (#12027)
- Loading branch information
1 parent
42340ee
commit 1d39b99
Showing
7 changed files
with
210 additions
and
182 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
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
title: Tab React component | ||
title: Tabs React component | ||
components: Tabs, Tab | ||
--- | ||
|
||
|
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,62 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import classNames from 'classnames'; | ||
import { loadCSS } from 'fg-loadcss/src/loadCSS'; | ||
import { withStyles } from '@material-ui/core/styles'; | ||
import red from '@material-ui/core/colors/red'; | ||
import Icon from '@material-ui/core/Icon'; | ||
|
||
const styles = theme => ({ | ||
root: { | ||
display: 'flex', | ||
justifyContent: 'center', | ||
alignItems: 'flex-end', | ||
}, | ||
icon: { | ||
margin: theme.spacing.unit * 2, | ||
}, | ||
iconHover: { | ||
margin: theme.spacing.unit * 2, | ||
'&:hover': { | ||
color: red[800], | ||
}, | ||
}, | ||
}); | ||
|
||
class FontAwesome extends React.Component { | ||
componentDidMount() { | ||
loadCSS( | ||
'https://use.fontawesome.com/releases/v5.1.0/css/all.css', | ||
document.querySelector('#insertion-point-jss'), | ||
); | ||
} | ||
|
||
render() { | ||
const { classes } = this.props; | ||
|
||
return ( | ||
<div className={classes.root}> | ||
<Icon className={classNames(classes.icon, 'fa fa-plus-circle')} /> | ||
<Icon className={classNames(classes.icon, 'fa fa-plus-circle')} color="primary" /> | ||
<Icon className={classNames(classes.icon, 'fa fa-plus-circle')} color="secondary" /> | ||
<Icon className={classNames(classes.icon, 'fa fa-plus-circle')} color="action" /> | ||
<Icon | ||
className={classNames(classes.iconHover, 'fa fa-plus-circle')} | ||
color="error" | ||
style={{ fontSize: 30 }} | ||
/> | ||
<Icon | ||
className={classNames(classes.icon, 'fa fa-plus-circle')} | ||
color="disabled" | ||
style={{ fontSize: 36 }} | ||
/> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
FontAwesome.propTypes = { | ||
classes: PropTypes.object.isRequired, | ||
}; | ||
|
||
export default withStyles(styles)(FontAwesome); |
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
Oops, something went wrong.