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

Implement animated list reordering for quote list #6078

Closed
woodenfurniture opened this issue Jan 25, 2024 · 0 comments · Fixed by #6080
Closed

Implement animated list reordering for quote list #6078

woodenfurniture opened this issue Jan 25, 2024 · 0 comments · Fixed by #6080
Assignees

Comments

@woodenfurniture
Copy link
Contributor

woodenfurniture commented Jan 25, 2024

Overview

Basically we want to keep quotes mounted and re-load their contents across different trade inputs, similar to how polling works presently. If the order changes, animate it rather than layout-shift abruptly.

Currently the list of received quotes is somewhat visually jarring because we arent able to persist a quote for a given swapper across different inputs. Instead, re re-mount a new component for every new input which creates a layout shift.

Additionally, the capability of displaying multiple quotes per swapper means we'd need to manage the visibility of these as different quotes become available and unavailable depending on the input.

References and additional details

Refactor the TradeQuotes component to persist a singular TradeQuote component per quote identifier. If the identifier is not present in the list of quotes, hide it but don't unmount it. Consider using animation to show and hide these to reduce visual jarring.

Use framer-motion MotionBox to manage animation of quote position without layout shifting

import { motion } from 'framer-motion';

const MotionBox = motion(Box);

// Inside your component's return statement
{listItems.map((item, index) => (
  <MotionBox
    key={item.id}
    layout
    initial={{ opacity: 0 }}
    animate={{ opacity: 1 }}
    exit={{ opacity: 0 }}
    p={5}
    shadow='md'
    borderWidth='1px'
  >
    {item.content}
  </MotionBox>
))}

Acceptance Criteria

  • Quotes of the same identifier persist across different trade inputs with loading state between fetches.
  • If a quote matching an identifier is not available for a given input, hide it but don't unmount it
  • When quotes load with different ordering, animate the change in order to reduce visual jarring

Need By Date

No response

Screenshots/Mockups

No response

Estimated effort

No response

@woodenfurniture woodenfurniture self-assigned this Jan 25, 2024
@woodenfurniture woodenfurniture moved this from To schedule to In progress in ShapeShift Dashboard Jan 25, 2024
@woodenfurniture woodenfurniture moved this from In progress to In review in ShapeShift Dashboard Jan 31, 2024
@github-project-automation github-project-automation bot moved this from In review to Done in ShapeShift Dashboard Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant