Skip to content

Commit

Permalink
fix(nui/slider): fixed progress calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
ardelan869 committed Sep 26, 2024
1 parent c0162b9 commit 51622b6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions web/src/components/items/slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default function Slider({
className,
...props
}: Omit<React.HTMLAttributes<HTMLElement>, 'children'>) {
const { selected, current = 0 } = useItem() as SliderProps;
const { selected, current = 0, max } = useItem() as SliderProps;

return (
<div
Expand All @@ -18,7 +18,10 @@ export default function Slider({
src="assets/images/arrowleft.png"
/>
<div className="bg-[#042039] w-[150px] h-[9px] overflow-hidden">
<div className="bg-[#3974C8] h-full" style={{ width: `${current}%` }} />
<div
className="bg-[#3974C8] h-full"
style={{ width: `${(current / max) * 100}%` }}
/>
</div>
<img
className={cn('w-2 h-2 object-contain', selected && 'invert')}
Expand Down

0 comments on commit 51622b6

Please sign in to comment.