import * as Switch from '@radix-ui/react-switch' import { ReaderSettings } from '../../../lib/hooks/useReaderSettings' import { HStack, VStack } from '../../elements/LayoutPrimitives' import { ModalRoot, ModalContent, ModalOverlay, } from '../../elements/ModalPrimitives' import { StyledText } from '../../elements/StyledText' import { ReaderSettingsControl } from './ReaderSettingsControl' import { styled } from '../../tokens/stitches.config' import { usePersistedState } from '../../../lib/hooks/usePersistedState' type PDFDisplaySettingsModalProps = { centerX: boolean onOpenChange: (open: boolean) => void triggerElementRef?: React.RefObject readerSettings: ReaderSettings } export function PDFDisplaySettingsModal( props: PDFDisplaySettingsModalProps ): JSX.Element { return ( { event.preventDefault() props.onOpenChange(false) }} > ) } type SettingsProps = { readerSettings: ReaderSettings } function PDFSettings(props: SettingsProps): JSX.Element { const { readerSettings } = props const [showPDFToolBar, setShowPDFToolBar] = usePersistedState({ key: 'reader-show-pdf-tool-bar', initialValue: true, isSessionStorage: false, }) return ( { setShowPDFToolBar(checked) document.dispatchEvent(new Event('pdfReaderUpdateSettings')) }} > {/* { readerSettings.setHighContrastText(checked) }} > */} ) } const SwitchRoot = styled(Switch.Root, { all: 'unset', width: 42, height: 25, backgroundColor: '$thBorderColor', borderRadius: '9999px', position: 'relative', WebkitTapHighlightColor: 'rgba(0, 0, 0, 0)', '&:focus': { boxShadow: `0 0 0 2px $thBorderColor` }, '&[data-state="checked"]': { backgroundColor: '$thBorderColor' }, }) const SwitchThumb = styled(Switch.Thumb, { display: 'block', width: 21, height: 21, backgroundColor: '$thTextContrast2', borderRadius: '9999px', transition: 'transform 100ms', transform: 'translateX(2px)', willChange: 'transform', '&[data-state="checked"]': { transform: 'translateX(19px)' }, }) const Label = styled('label', { color: 'white', fontSize: 15, lineHeight: 1, })