1
0
mirror of https://github.com/kremalicious/portfolio.git synced 2024-12-31 09:07:38 +01:00

animation tweaks

This commit is contained in:
Matthias Kretschmann 2018-05-05 17:52:23 +02:00
parent be35be544b
commit a1c4e2f62e
Signed by: m
GPG Key ID: 606EEEF3C479A91F
4 changed files with 66 additions and 52 deletions

View File

@ -1,4 +1,4 @@
import React, { Fragment } from 'react'
import React from 'react'
import PropTypes from 'prop-types'
import { OutboundLink } from 'gatsby-plugin-google-analytics'
import { FadeIn } from '../atoms/Animations'
@ -34,24 +34,22 @@ const Social = ({ meta, minimal, hide }) => {
const classes = minimal ? 'social social--minimal' : 'social'
return (
<Fragment>
{!hide && (
<FadeIn>
<aside className={classes}>
{Object.keys(social).map((key, i) => (
<OutboundLink
className="social__link"
href={social[key]}
key={i}
title={key}
>
<SocialIcon title={key} className="icon" />
</OutboundLink>
))}
</aside>
</FadeIn>
)}
</Fragment>
!hide && (
<FadeIn timeout={{ enter: 200, exit: 0, appear: 200 }}>
<aside className={classes}>
{Object.keys(social).map((key, i) => (
<OutboundLink
className="social__link"
href={social[key]}
key={i}
title={key}
>
<SocialIcon title={key} className="icon" />
</OutboundLink>
))}
</aside>
</FadeIn>
)
)
}

View File

@ -2,9 +2,9 @@
.social {
margin-top: $spacer * 2;
width: 100%;
display: flex;
justify-content: center;
width: 100%;
}
.social__link {
@ -16,7 +16,6 @@
align-items: center;
justify-content: center;
border-radius: .25rem;
transition-property: transform, background, box-shadow;
@media (min-width: 30rem) {
margin-left: $spacer / 2;

View File

@ -1,31 +1,44 @@
import React from 'react'
import React, { Component } from 'react'
import Link from 'gatsby-link'
import PropTypes from 'prop-types'
import { FadeIn } from '../atoms/Animations'
import Social from '../molecules/Social'
import Availability from '../molecules/Availability'
import { ReactComponent as Logo } from '../../images/logo.svg'
import './Header.scss'
const Header = ({ meta, isHomepage }) => {
const classes = isHomepage ? 'header' : 'header header--minimal'
class Header extends Component {
render() {
const isHomepage = this.props.isHomepage
const meta = this.props.meta
return (
<header className={classes}>
<Link className="header__name" to={'/'}>
<Logo className="header__logo" />
<h1 className="header__title">{meta.title.toLowerCase()}</h1>
<p className="header__description">
<span>{'{ '}</span> {meta.tagline.toLowerCase()} <span>{' }'}</span>
</p>
</Link>
let classes = 'header'
if (!isHomepage) {
classes += ' header--minimal'
}
<Social meta={meta} hide={!isHomepage} />
<Availability
meta={meta}
hide={!isHomepage && !meta.availability.status}
/>
</header>
)
return (
<header className={classes}>
<FadeIn>
<Link className="header__name" to={'/'}>
<Logo className="header__logo" />
<h1 className="header__title">{meta.title.toLowerCase()}</h1>
<p className="header__description">
<span>{'{ '}</span> {meta.tagline.toLowerCase()}{' '}
<span>{' }'}</span>
</p>
</Link>
</FadeIn>
<Social meta={meta} hide={!isHomepage} />
<Availability
meta={meta}
hide={!isHomepage && !meta.availability.status}
/>
</header>
)
}
}
Header.propTypes = {

View File

@ -19,6 +19,8 @@ class TransitionHandler extends Component {
}
}
const Main = ({ children }) => <main className="screen">{children}</main>
const TemplateWrapper = ({ data, location, children }) => {
const meta = data.dataYaml
const isHomepage = location.pathname === '/'
@ -28,18 +30,16 @@ const TemplateWrapper = ({ data, location, children }) => {
<Head meta={meta} location={location} />
<Header meta={meta} isHomepage={isHomepage} />
<main className="screen">
<TransitionGroup appear={true}>
<FadeIn
key={location.pathname}
timeout={{ enter: 200, exit: 150, appear: 200 }}
>
<TransitionHandler location={location}>
{children()}
</TransitionHandler>
</FadeIn>
</TransitionGroup>
</main>
<TransitionGroup component={Main} appear={true}>
<FadeIn
key={location.pathname}
timeout={{ enter: 200, exit: 150, appear: 200 }}
>
<TransitionHandler location={location}>
{children()}
</TransitionHandler>
</FadeIn>
</TransitionGroup>
<Footer meta={meta} />
</div>
@ -51,6 +51,10 @@ TransitionHandler.propTypes = {
location: PropTypes.object.isRequired,
}
Main.propTypes = {
children: PropTypes.any,
}
TemplateWrapper.propTypes = {
children: PropTypes.func,
data: PropTypes.object.isRequired,