21 lines
469 B
TypeScript
21 lines
469 B
TypeScript
/* Shared open state for the article search popup (SearchModal.vue).
|
|
The sidebar search bar and the keyboard shortcuts flip this flag;
|
|
the modal itself owns the live searching. */
|
|
export function useSearch() {
|
|
const open = useState<boolean>('search:open', () => false)
|
|
|
|
function show() {
|
|
open.value = true
|
|
}
|
|
|
|
function hide() {
|
|
open.value = false
|
|
}
|
|
|
|
function toggle() {
|
|
open.value = !open.value
|
|
}
|
|
|
|
return { open, show, hide, toggle }
|
|
}
|