import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import { StaticQuery, graphql } from 'gatsby' import posed from 'react-pose' import { moveInTop } from '../atoms/Transitions' import Email from '../svg/Email' import Blog from '../svg/Blog' import Twitter from '../svg/Twitter' import GitHub from '../svg/Github' import Dribbble from '../svg/Dribbble' import icons from '../atoms/Icons.module.scss' import styles from './Networks.module.scss' const query = graphql` query { dataYaml { social { Email Blog Twitter GitHub Dribbble } } } ` const NetworkIcon = props => { switch (props.title) { case 'Email': return case 'Blog': return case 'Twitter': return case 'GitHub': return case 'Dribbble': return default: return null } } const Animation = posed.aside(moveInTop) export default class Network extends PureComponent { static propTypes = { minimal: PropTypes.bool, hide: PropTypes.bool } state = { classes: styles.networks } componentDidMount() { this.toggleClasses() } componentDidUpdate() { this.toggleClasses() } toggleClasses = () => { if (this.props.minimal) { this.setState({ classes: `${styles.networks} ${styles.minimal}` }) } else { this.setState({ classes: styles.networks }) } } render() { return ( { const meta = data.dataYaml return ( !this.props.hide && ( {Object.keys(meta.social).map((key, i) => ( {key} ))} ) ) }} /> ) } }