feat: make whole menu switch be clickable (#837)

This commit is contained in:
Aman Harwara
2022-01-31 22:19:27 +05:30
committed by GitHub
parent cf1720ba20
commit 7c41cfc3dc
2 changed files with 31 additions and 27 deletions

View File

@@ -159,22 +159,26 @@ const SpellcheckOptions: FunctionComponent<{
: undefined; : undefined;
return ( return (
<div className="flex flex-col px-3 py-1.5"> <div className="flex flex-col">
<Switch <button
className="px-0 py-0" className="sn-dropdown-item justify-between px-3 py-1"
checked={noteSpellcheck} onClick={() => {
disabled={!spellcheckControllable}
onChange={() => {
appState.notes.toggleGlobalSpellcheckForNote(note); appState.notes.toggleGlobalSpellcheckForNote(note);
}} }}
disabled={!spellcheckControllable}
> >
<span className="flex items-center"> <span className="flex items-center">
<Icon type="spellcheck" className={iconClass} /> <Icon type="spellcheck" className={iconClass} />
Spellcheck Spellcheck
</span> </span>
</Switch> <Switch
className="px-0"
checked={noteSpellcheck}
disabled={!spellcheckControllable}
/>
</button>
{!spellcheckControllable && ( {!spellcheckControllable && (
<p className="text-xs pt-1.5"> <p className="text-xs px-3 py-1.5">
Spellcheck cannot be controlled for this editor. Spellcheck cannot be controlled for this editor.
</p> </p>
)} )}
@@ -331,45 +335,45 @@ export const NotesOptions = observer(
return ( return (
<> <>
<Switch <button
onBlur={closeOnBlur} className="sn-dropdown-item justify-between"
className="px-3 py-1.5" onClick={() => {
checked={locked}
onChange={() => {
appState.notes.setLockSelectedNotes(!locked); appState.notes.setLockSelectedNotes(!locked);
}} }}
onBlur={closeOnBlur}
> >
<span className="flex items-center"> <span className="flex items-center">
<Icon type="pencil-off" className={iconClass} /> <Icon type="pencil-off" className={iconClass} />
Prevent editing Prevent editing
</span> </span>
</Switch> <Switch className="px-0" checked={locked} />
<Switch </button>
onBlur={closeOnBlur} <button
className="px-3 py-1.5" className="sn-dropdown-item justify-between"
checked={!hidePreviews} onClick={() => {
onChange={() => {
appState.notes.setHideSelectedNotePreviews(!hidePreviews); appState.notes.setHideSelectedNotePreviews(!hidePreviews);
}} }}
onBlur={closeOnBlur}
> >
<span className="flex items-center"> <span className="flex items-center">
<Icon type="rich-text" className={iconClass} /> <Icon type="rich-text" className={iconClass} />
Show preview Show preview
</span> </span>
</Switch> <Switch className="px-0" checked={!hidePreviews} />
<Switch </button>
onBlur={closeOnBlur} <button
className="px-3 py-1.5" className="sn-dropdown-item justify-between"
checked={protect} onClick={() => {
onChange={() => {
appState.notes.setProtectSelectedNotes(!protect); appState.notes.setProtectSelectedNotes(!protect);
}} }}
onBlur={closeOnBlur}
> >
<span className="flex items-center"> <span className="flex items-center">
<Icon type="password" className={iconClass} /> <Icon type="password" className={iconClass} />
Protect Protect
</span> </span>
</Switch> <Switch className="px-0" checked={protect} />
</button>
<div className="min-h-1px my-2 bg-border"></div> <div className="min-h-1px my-2 bg-border"></div>
{appState.tags.tagsCount > 0 && ( {appState.tags.tagsCount > 0 && (
<Disclosure open={tagsMenuOpen} onChange={openTagsMenu}> <Disclosure open={tagsMenuOpen} onChange={openTagsMenu}>

View File

@@ -643,7 +643,7 @@
width: 100%; width: 100%;
} }
.cursor-not-allowed { .sn-component .cursor-not-allowed {
cursor: not-allowed; cursor: not-allowed;
} }