-
-
Notifications
You must be signed in to change notification settings - Fork 521
Smooth animation for expanding/collapsing repositories list #1069
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
Closed
Closed
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
a0bcb76
Enhancement: Implement smooth animations for expandable lists & refac…
rishyym0927 27a72da
test
rishyym0927 a02a661
Merge branch 'main' into feature/animation
kasya b98cae3
Test e2e fixes format
rishyym0927 7fb6370
Fix tests
rishyym0927 92c0887
Test unit fix
rishyym0927 edf89a7
Test CI/CD fix
rishyym0927 e74d8e4
Merge branch 'main' into feature/animation
rishyym0927 44b80b5
Merge branch 'OWASP:main' into feature/animation
rishyym0927 9ad0716
Merge branch 'main' into feature/animation
arkid15r 740ca80
Merge branch 'main' into feature/animation
kasya File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import { useState, useEffect } from 'react' | ||
|
|
||
| export const useExpandableList = <T>(items: T[], maxInitialDisplay: number) => { | ||
| const [showAll, setShowAll] = useState(false) | ||
| const [animatingOut, setAnimatingOut] = useState(false) | ||
| const [visibleItems, setVisibleItems] = useState<T[]>(items.slice(0, maxInitialDisplay)) | ||
|
|
||
| useEffect(() => { | ||
| if (showAll) { | ||
| setVisibleItems(items) | ||
| setAnimatingOut(false) | ||
| } else if (animatingOut) { | ||
| const timer = setTimeout(() => { | ||
| setVisibleItems(items.slice(0, maxInitialDisplay)) | ||
| setAnimatingOut(false) | ||
| }, 500) | ||
| return () => clearTimeout(timer) | ||
| } | ||
| }, [showAll, animatingOut, items, maxInitialDisplay]) | ||
|
|
||
| const toggleShowAll = () => { | ||
| if (showAll) { | ||
| setAnimatingOut(true) | ||
| setTimeout(() => setShowAll(false), 50) | ||
| } else { | ||
| setShowAll(true) | ||
| } | ||
| } | ||
|
|
||
| return { visibleItems, showAll, animatingOut, toggleShowAll } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rishyym0927 please use action button here, we have it in components, or if it does not fit with your requirements please create a separate button component that is modular and reusable, and one more thing we are using Chakra UI so if possible try to use components from the chakra ui library whenever possible to maintain consistency across the code base.
Thank you :)