Files
readest/apps/readest-app/src/app/reader/components/settings/DialogMenu.tsx
T
Huang Xin 6b09145546 ui: fix highlight text not clear in dark mode (#244)
* ui: fix highlight background color in dark mode

* i18n: more consistent tanslations
2025-01-25 00:55:53 +01:00

49 lines
1.5 KiB
TypeScript

import React from 'react';
import { MdCheck } from 'react-icons/md';
import { useSettingsStore } from '@/store/settingsStore';
import { useTranslation } from '@/hooks/useTranslation';
import { useDefaultIconSize } from '@/hooks/useResponsiveSize';
interface DialogMenuProps {
toggleDropdown?: () => void;
}
const DialogMenu: React.FC<DialogMenuProps> = ({ toggleDropdown }) => {
const _ = useTranslation();
const iconSize = useDefaultIconSize();
const { isFontLayoutSettingsGlobal, setFontLayoutSettingsGlobal } = useSettingsStore();
const handleToggleGlobal = () => {
setFontLayoutSettingsGlobal(!isFontLayoutSettingsGlobal);
toggleDropdown?.();
};
return (
<div
tabIndex={0}
className='dropdown-content dropdown-right no-triangle border-base-200 z-20 mt-1 w-44 border shadow-2xl'
>
<button
className='hover:bg-base-200 text-base-content flex w-full items-center justify-between rounded-md p-2'
onClick={handleToggleGlobal}
>
<div className='flex items-center'>
<span style={{ minWidth: `${iconSize}px` }}>
{isFontLayoutSettingsGlobal && <MdCheck className='text-base-content' />}
</span>
<div
className='lg:tooltip'
data-tip={
isFontLayoutSettingsGlobal ? _('Apply to All Books') : _('Apply to This Book')
}
>
<span className='ml-2'>{_('Global Settings')}</span>
</div>
</div>
</button>
</div>
);
};
export default DialogMenu;