Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Stack View Animation #4799

Merged
merged 14 commits into from
Feb 13, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
added view transition when navigating between two columns
Resaki1 committed Jan 22, 2025
commit c75e5d72b4c362117025416aca55ceb00f17e6d5
2 changes: 1 addition & 1 deletion src/components/BoardReactionMenu/BoardReactionMenu.tsx
Original file line number Diff line number Diff line change
@@ -53,7 +53,7 @@ export const BoardReactionMenu = forwardRef((props: BoardReactionMenuProps, ref:
from: {opacity: 0, transform: "scale(0.3, 0.9) translateY(100%)", "pointer-events": "none"},
enter: {opacity: 1, transform: "scale(1, 1) translateY(0%)", "pointer-events": "auto"},
leave: {opacity: 0, transform: "scale(0.3, 0.9) translateY(100%)", "pointer-events": "none"},
config: {mass: 1, friction: 20, tension: 380},
config: {mass: 1, friction: 30, tension: 380},
});

return menuTransition(
2 changes: 0 additions & 2 deletions src/components/NoteDialogComponents/NoteDialogHeader.scss
Original file line number Diff line number Diff line change
@@ -27,8 +27,6 @@
background: var(--accent-color--light);
border-radius: $rounded--full;
margin-top: $spacing--base;

transition: all 0.2s ease-out;
}
}
}
12 changes: 9 additions & 3 deletions src/components/StackNavigation/StackNavigation.tsx
Original file line number Diff line number Diff line change
@@ -28,12 +28,18 @@ export const StackNavigation: FC<StackNavigationProps> = ({stacks, currentStack,
};

// takes the index of the stack we want to navigate to
// if the index is out of bounds, it will navigate to the previous or next column
// if the index is out of bounds, it will navigate to the previous or next column, animated using the View Transition API
const handleNavigation = (index: number) => {
const stackId = getStackId(index);
if (stackId) {
handleModeration(stackId);
navigate(`../note/${stackId}/stack`);
if (stacks[index]) {
handleModeration(stackId);
navigate(`../note/${stackId}/stack`);
} else
document.startViewTransition(() => {
handleModeration(stackId);
navigate(`../note/${stackId}/stack`);
});
}
};