diff --git a/src/components/molecules/ProjectNav.jsx b/src/components/molecules/ProjectNav.jsx index c9932ad..d84836c 100644 --- a/src/components/molecules/ProjectNav.jsx +++ b/src/components/molecules/ProjectNav.jsx @@ -24,32 +24,6 @@ const query = graphql` } ` -class Project extends PureComponent { - static propTypes = { - node: PropTypes.object.isRequired, - currentSlug: PropTypes.string.isRequired, - refCurrentItem: PropTypes.any - } - - render() { - const { node, currentSlug, refCurrentItem } = this.props - const isCurrent = node.slug === currentSlug - - return ( -
- - {node.title} -

{node.title}

- -
- ) - } -} - export default class ProjectNav extends PureComponent { static propTypes = { currentSlug: PropTypes.string.isRequired @@ -82,18 +56,26 @@ export default class ProjectNav extends PureComponent { activeRect.width / 2 scrollContainer.scrollLeft += this.state.scrollLeftPosition + this.setState({ scrollLeftPosition }) + } - this.setState(state => { - return { - ...state, - scrollLeftPosition - } - }) + Project({ node, refCurrentItem }) { + return ( +
+ + {node.title} +

{node.title}

+ +
+ ) } render() { const { currentSlug } = this.props - return ( - {projects.map(({ node }) => ( - - ))} + {projects.map(({ node }) => { + const isCurrent = node.slug === currentSlug + + return ( + + ) + })} ) }}