gatsby-plugin-transition-link icon indicating copy to clipboard operation
gatsby-plugin-transition-link copied to clipboard

AniLink no animation for nav menu items

Open omattman opened this issue 5 years ago • 5 comments

Hello, I've implemented AniLink animation across all of my site and as the last thing I had to implement it for links inside the main navigation. However, the animations aren't being triggered.

This is used within a Gatsby v2 project for clarification.

This is the AniLink component:

import React from 'react'
import AniLink from 'gatsby-plugin-transition-link/AniLink'

const AniLinkCover = props => (
  <AniLink
    cover
    direction={props.dir}
    top="exit"
    duration={0.7}
    to={props.to}
    bg="#27c17d"
  >
    {props.children}
  </AniLink>
)

export default AniLinkCover

And this is my nav menu items:

import React from 'react'
import TransitionCover from '../Links/AniLinkCover'

const MenuItemsPrimary = props => {
  return (
    <ul className="nav__main--list">
      {props.filter.map((item, index) => {
        if (index <= props.boundry) {
          return (
            <li key={item.object_slug} className="nav__main--list-item t__h2 f__bold">
              <TransitionCover to={item.object_slug} dir="down">
                {item.title}
              </TransitionCover>
            </li>
          )
        }
      })}
    </ul>
  )
}

export default MenuItemsPrimary

Is there some certain edge case, which I haven't thought of?

omattman avatar May 17 '19 21:05 omattman

Are you using a layout component for the main navigation? If so are you using the built in layout option or gatsby-plugin-layout?

TylerBarnes avatar May 17 '19 22:05 TylerBarnes

Facing similar problems. Is it recommended to only go with gatsby-plugin-layout to have the animations working properly?

smbt avatar Aug 21 '19 14:08 smbt

@smbt , no gatsby-plugin-layout would potentially stop transitions from working anywhere. This will be fixed in this plugin

TylerBarnes avatar Aug 21 '19 17:08 TylerBarnes

Any workarounds for the meantime?

jayasio avatar Feb 12 '20 06:02 jayasio

@jayasio , there was a recent change that may make this work but I haven't had time to try it out. Are you on the latest version?

TylerBarnes avatar Feb 13 '20 21:02 TylerBarnes