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(AppFrame): nav bar scroll fix and sub nav chevron update #1414

Merged
merged 3 commits into from
Oct 22, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ $base-class: 'navigation-group';
list-style: none;

&--scrollable {
overflow-y: scroll;
overflow: hidden scroll;
scrollbar-width: none;

&::-webkit-scrollbar {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export const NavigationItem: React.FC<INavigationItemProps> = ({
{icon}
{isMobileViewEnabled && label}
</a>
{badge && getBadge(badge, id)}
{!!badge && getBadge(badge, id)}
</>
}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ $transition: all var(--transition-duration-fast-2) ease-in-out;

&__chevron {
transition: $transition;
opacity: 0.6;

&--active {
transform: rotate(90deg);
opacity: 1;
}
}

Expand Down
15 changes: 5 additions & 10 deletions packages/react-components/src/hooks/useAnimations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,17 @@ export const useAnimations = ({
const [isOpen, setIsOpen] = React.useState(isVisible);
const [shouldBeVisible, setShouldBeVisible] = React.useState(isVisible);

const handleTransitionEnd = () => setIsMounted(false);

// The main part of the logic responsible for managing the states used to animate the container opening/closing and mounting/unmounting the container elements
React.useEffect(() => {
const currentElement = elementRef.current;

if (!shouldBeVisible && currentElement) {
const handleTransitionEnd = () => setIsMounted(false);

currentElement.addEventListener('transitionend', handleTransitionEnd);
currentElement.addEventListener('transitionend', handleTransitionEnd, {
once: true,
});
setIsOpen(false);

return () => {
currentElement.removeEventListener(
'transitionend',
handleTransitionEnd
);
};
}

if (shouldBeVisible) {
Expand Down
Loading