Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

enhancement: Smoothed modal animation + reduced motion #174

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

Merged
psychlone77 merged 9 commits into quicksnip-dev:main from Yugveer06:motion
Jan 5, 2025
Merged
Show file tree
Hide file tree
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
doc: added some comments
  • Loading branch information
Yugveer06 committed Jan 4, 2025
commit fbf4efd02ab9ed55c8a9aa00ee5cd495ad38313b
3 changes: 2 additions & 1 deletion src/components/SnippetList.tsx
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const SnippetList = () => {
return (
<motion.li
key={currentSnippet.title + idx}
layoutId={currentSnippet.title + (idx + 1).toString()}
layoutId={currentSnippet.title + (idx + 1).toString()} // unique id for layout animation
initial={{ opacity: 0, y: 20 }}
animate={{
opacity: 1,
Expand Down Expand Up @@ -69,6 +69,7 @@ const SnippetList = () => {
onClick={() =>
handleOpenModal({
...currentSnippet,
// added idx for the layout animation to work correctly
idx: idx + 1,
})
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/SnippetModal.tsx
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const SnippetModal: React.FC<Props> = ({
key="modal-content"
className="modal | flow"
data-flow-space="lg"
layoutId={snippet.title + snippet.idx?.toString()}
layoutId={snippet.title + snippet.idx?.toString()} // unique id for layout animation
transition={{ type: "spring", duration: shouldReduceMotion ? 0 : 0.5 }}
>
<div className="modal__header">
Expand Down
2 changes: 1 addition & 1 deletion src/types/index.ts
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export type SnippetType = {
code: string;
tags: string[];
author: string;
idx?: number; // Add optional idx property
idx?: number;
};

export type AppState = {
Expand Down
Loading

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /