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
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion src/components/BoardReactionMenu/BoardReactionMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 0 additions & 2 deletions src/components/NoteDialogComponents/NoteDialogHeader.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
background: var(--accent-color--light);
border-radius: $rounded--full;
margin-top: $spacing--base;

transition: all 0.2s ease-in-out;
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/Portal/Portal.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {FC, HTMLAttributes, PropsWithChildren} from "react";
import FocusLock from "react-focus-lock";
import ReactDOM from "react-dom";
import {createPortal} from "react-dom";
import {useWindowEvent} from "utils/hooks/useWindowEvent";
import classNames from "classnames";
import "./Portal.scss";
Expand Down Expand Up @@ -37,7 +37,7 @@ export const Portal: FC<PropsWithChildren<PortalProps>> = ({onClose, hiddenOverf
return theme === "light" ? "accent-color__backlog-blue" : "accent-color__planning-pink";
};

return ReactDOM.createPortal(
return createPortal(
<div className={classNames("portal", className)} onClick={() => onClose?.()} role="dialog" {...otherProps}>
<FocusLock autoFocus={false} returnFocus>
<div
Expand Down
12 changes: 9 additions & 3 deletions src/components/StackNavigation/StackNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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] || !document.startViewTransition) {
handleModeration(stackId);
navigate(`../note/${stackId}/stack`);
} else
document.startViewTransition(() => {
handleModeration(stackId);
navigate(`../note/${stackId}/stack`);
});
}
};

Expand Down
17 changes: 13 additions & 4 deletions src/routes/StackView/StackView.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ $stack-view__min-height: 82px;
.stack-view__portal {
backdrop-filter: blur(10px) brightness(0.76) saturate(0);
background: rgba(var(--accent-color--light-rgb), 0.42);
transition: all 0.2s ease-in-out;
transition: background 0.2s ease-out;
}

.stack-view {
Expand All @@ -26,6 +26,7 @@ $stack-view__min-height: 82px;
pointer-events: none;
background: transparent;
box-shadow: inset 0 0 0 $column__border-width var(--accent-color--light);
transition: box-shadow 0.2s ease-out;
}

.stack-view__border--moderating {
Expand All @@ -35,10 +36,11 @@ $stack-view__min-height: 82px;
.stack-view__content {
position: relative;

height: auto;
height: calc(100vh - $stack-view__header-height - $stack-view__navigation-height);
width: 100vw;
border-radius: $note__border-radius;

overflow: hidden;
overflow: visible;

@include scrollbar();
}
Expand All @@ -52,8 +54,15 @@ $stack-view__min-height: 82px;
}

.stack-view__animation-wrapper {
display: flex;
justify-content: center;
width: 100%;
}

.stack-view__notes {
display: flex;
flex-direction: row;
justify-content: flex-start;
max-height: $stack-content-max-height;
gap: $spacing--sm;
}
Expand Down Expand Up @@ -111,7 +120,7 @@ $stack-view__min-height: 82px;
}

@media screen and (max-width: $breakpoint--desktop) {
.stack-view__animation-wrapper {
.stack-view__notes {
flex-direction: column;
max-height: initial;
}
Expand Down
4 changes: 2 additions & 2 deletions src/routes/StackView/StackView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ export const StackView = () => {
) => (
<animated.div style={styles} className="stack-view__animation-wrapper">
{item.parent && item.parent.position.column === column?.id && (
<>
<div className="stack-view__notes">
<NoteDialogComponents.Note
key={item.parent.id}
noteId={item.parent.id}
Expand Down Expand Up @@ -306,7 +306,7 @@ export const StackView = () => {
))}
</NoteDialogComponents.Wrapper>
) : null}
</>
</div>
)}
</animated.div>
)}
Expand Down
Loading