mars-v2-frontend/src/components/Slider.tsx
Linkie Link 21268e5536
UI style updates (#106)
* feat: updates on the button styles

* env: updated yarn.lock

* fix: added account actions

* fix: updated the orbs logic

* fix: fixed the blur presets

* feat: updated the button logic

* fix: wallet modal style adjustments

* fix: updated close icon

* fix: fixed the close button

* fix: fix types

* fix: fixed the build

* tidy: component cleanup

* feat:  added new AccountDetails component

* refactor: propper usage of tailwind

* refactor: imports

* feat: added pages for all scenarios

* fix: fix the loading component

* fix: remove loading from default trade

* fix: fixed the build

* fix: fixed losing the provider on hotplug

* tidy: remove unused code

* fix: added error messages

* add borrow page structure

* env: enhanced debugging by restructuring the ENV object

* fix: fixed the build

* fix: fixed the wording on missing env variables

* feat: added button hover (#112)

* feat: added button hover

* fix: added bg transition to primary buttons

* feat: pages refactored (#111)

* feat: pages refactored

* fix: added loader for AccountNavigation

* fix: fixed the wallet store management

* fix: get rid of the walletSlice and refactor

* fix: added gap to the borrow page

* fix: fixed some dependencies

* fix: added initClients back

* fix: fixed according to feedback

---------

Co-authored-by: bwvdhelm <34470358+bobthebuidlr@users.noreply.github.com>
2023-03-08 10:44:39 +01:00

37 lines
1.2 KiB
TypeScript

import * as RadixSlider from '@radix-ui/react-slider'
type Props = {
className?: string
value: number
onChange: (value: number[]) => void
onMaxClick: () => void
}
export const Slider = ({ className, value, onChange, onMaxClick }: Props) => {
return (
<div className={`relative flex flex-1 items-center ${className || ''}`}>
<RadixSlider.Root
className='relative flex h-[20px] w-full cursor-pointer touch-none select-none items-center'
value={[value]}
min={0}
max={100}
step={1}
onValueChange={(value) => onChange(value)}
>
<RadixSlider.Track className='relative h-[6px] grow rounded-full bg-gray-400'>
<RadixSlider.Range className='absolute h-[100%] rounded-full bg-blue-600' />
</RadixSlider.Track>
<RadixSlider.Thumb className='flex h-[20px] w-[20px] items-center justify-center rounded-full bg-white !outline-none'>
<div className='relative top-5 text-xs'>{value.toFixed(0)}%</div>
</RadixSlider.Thumb>
</RadixSlider.Root>
<button
className='ml-4 rounded-base bg-blue-600 py-1 px-2 text-xs font-semibold text-white'
onClick={onMaxClick}
>
MAX
</button>
</div>
)
}