Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

Commit

Permalink
fix: pass all available gatsby link props through
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyler Barnes committed Apr 3, 2019
1 parent e1051ac commit 0b7a1f0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
10 changes: 9 additions & 1 deletion src/components/TransitionLink.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,34 @@ const TransitionLink = ({
exit,
entry,
activeStyle,
partiallyActive,
style,
className,
activeClassName,
state,
onClick,
trigger,
replace,
...rest
}) => {
return (
<Consumer>
{({ ...context }) => (
<Link
activeStyle={activeStyle}
style={style}
activeStyle={activeStyle}
className={className}
activeClassName={activeClassName}
partiallyActive={partiallyActive}
onClick={event => {
triggerTransition({
event,
to,
exit,
entry,
trigger,
replace,
linkState: state,
...context
});

Expand Down
16 changes: 13 additions & 3 deletions src/utils/triggerTransition.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ const triggerTransition = ({
transitionIdHistory,
pages,
trigger,
updateContext
updateContext,
linkState,
replace
}) => {
event.persist();
event.preventDefault();
Expand Down Expand Up @@ -63,10 +65,18 @@ const triggerTransition = ({
e: event
});

// after exitDelay
setTimeout(() => {
// after exitDelay
const transitionId = random(10000, 99999, false);
navigate(to, { state: { transitionId: transitionId } });

navigate(to, {
state: {
transitionId,
...linkState
},
replace
});

updateContext({
exitState: exitState,
transitionIdHistory: [...transitionIdHistory, transitionId]
Expand Down

0 comments on commit 0b7a1f0

Please sign in to comment.