Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/FoxxMD/multi-scrobbler. Scrobble plays from multiple sources to multiple clients docs.multi-scrobbler.app
deezer docker jellyfin koito lastfm listenbrainz maloja mopidy mpris music music-assistant plex scrobble self-hosted spotify subsonic tautulli youtube-music
Something went wrong. Try again.
692 B · 26 lines
TSX
1234567891011121314151617181920212223242526import { Button } from '@chakra-ui/react';import { type ComponentProps, useState } from "react";
interface ToggleButtonProps { value?: boolean initialValue?: boolean onChange?: (val: boolean) => void}
const noop = (_) => null;
export const ToggleButtonVariant = (props: ToggleButtonProps & ComponentProps<typeof Button>) => {
const { value: propVal, initialValue = false, onChange = noop, children, variant, ...rest } = props;
const [value, setValue] = useState(propVal ?? initialValue);
return <Button variant={value ? 'surface' : 'outline'} onClick={() => setValue(!value)} {...rest}>{children}</Button>;}