mirror of
https://github.com/kremalicious/portfolio.git
synced 2025-01-03 10:25:00 +01:00
refactor, simplify markup
This commit is contained in:
parent
851d8fd4a3
commit
b455bea27f
@ -2,9 +2,19 @@ import React, { Component } from 'react'
|
|||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import Link from 'gatsby-link'
|
import Link from 'gatsby-link'
|
||||||
import Img from 'gatsby-image'
|
import Img from 'gatsby-image'
|
||||||
import FullWidth from '../atoms/FullWidth'
|
|
||||||
import styles from './ProjectNav.module.scss'
|
import styles from './ProjectNav.module.scss'
|
||||||
|
|
||||||
|
const ProjectLink = ({ node }) => (
|
||||||
|
<Link className={styles.link} to={node.slug}>
|
||||||
|
<Img
|
||||||
|
className={styles.image}
|
||||||
|
sizes={node.img.childImageSharp.sizes}
|
||||||
|
alt={node.title}
|
||||||
|
/>
|
||||||
|
<h1 className={styles.title}>{node.title}</h1>
|
||||||
|
</Link>
|
||||||
|
)
|
||||||
|
|
||||||
class ProjectNav extends Component {
|
class ProjectNav extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props)
|
super(props)
|
||||||
@ -33,7 +43,6 @@ class ProjectNav extends Component {
|
|||||||
const { projects, project } = this.props
|
const { projects, project } = this.props
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FullWidth>
|
|
||||||
<nav
|
<nav
|
||||||
className={styles.projectNav}
|
className={styles.projectNav}
|
||||||
ref={node => {
|
ref={node => {
|
||||||
@ -51,23 +60,19 @@ class ProjectNav extends Component {
|
|||||||
if (current) this.currentItem = node
|
if (current) this.currentItem = node
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Link className={styles.link} to={node.slug}>
|
<ProjectLink node={node} />
|
||||||
<Img
|
|
||||||
className={styles.image}
|
|
||||||
sizes={node.img.childImageSharp.sizes}
|
|
||||||
alt={node.title}
|
|
||||||
/>
|
|
||||||
<h1 className={styles.title}>{node.title}</h1>
|
|
||||||
</Link>
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
</nav>
|
</nav>
|
||||||
</FullWidth>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ProjectLink.propTypes = {
|
||||||
|
node: PropTypes.object
|
||||||
|
}
|
||||||
|
|
||||||
ProjectNav.propTypes = {
|
ProjectNav.propTypes = {
|
||||||
projects: PropTypes.array,
|
projects: PropTypes.array,
|
||||||
project: PropTypes.object
|
project: PropTypes.object
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
@import 'variables';
|
@import 'variables';
|
||||||
|
|
||||||
.projectNav {
|
.projectNav {
|
||||||
|
composes: fullWidth from '../atoms/FullWidth.module.scss';
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
overflow-y: hidden;
|
overflow-y: hidden;
|
||||||
overflow-x: scroll;
|
overflow-x: scroll;
|
||||||
|
Loading…
Reference in New Issue
Block a user