-
Notifications
You must be signed in to change notification settings - Fork 0
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
Corousel #28
base: dev
Are you sure you want to change the base?
Conversation
@@ -28,6 +28,10 @@ const sidebarLinks = [ | |||
name: 'Pill', | |||
ref: '/pill', | |||
}, | |||
{ | |||
name: 'Corousel', |
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.
Should be Carousel.
There are other spelling errors too. You can also use this extension to automatically check for any mistakes that might have accidentally crept in during typing.
|
||
const getWidth = () => coroselRef.current.getBoundingClientRect().width; | ||
|
||
const nextSlide = () => { |
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.
We can perhaps merge the nextSlide
and prevSlide
to a single method that takes in the operation type and applies the modulus method of circular iteration over the items. Would reduce the need for if clause and repeated code over the methods. The formula to calculate next index should be (x+(operation)+N)%N
where x is the current index, the operation is +1 or -1 and N is the total number of items.
activeIndex: 0, | ||
translate: 0, | ||
transition: 0.45, | ||
}); |
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.
Maybe we can take out the transition to a constant since it is never updated?
|
No description provided.