mirror of
https://github.com/aljazceru/rabbit.git
synced 2025-12-17 05:54:19 +01:00
update
This commit is contained in:
20
src/hooks/useModalState.ts
Normal file
20
src/hooks/useModalState.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { createSignal, type Signal } from 'solid-js';
|
||||
|
||||
type ModalState =
|
||||
| { type: 'Profile'; pubkey: string }
|
||||
| { type: 'UserTimeline'; pubkey: string }
|
||||
| { type: 'Closed' };
|
||||
|
||||
const [modalState, setModalState] = createSignal<ModalState>({ type: 'Closed' });
|
||||
|
||||
const useModalState = () => {
|
||||
const showProfile = (pubkey: string) => {
|
||||
setModalState({ type: 'Profile', pubkey });
|
||||
};
|
||||
const closeModal = () => {
|
||||
setModalState({ type: 'Closed' });
|
||||
};
|
||||
return { modalState, setModalState, showProfile, closeModal };
|
||||
};
|
||||
|
||||
export default useModalState;
|
||||
Reference in New Issue
Block a user