From 82429caf3c2886c2d94e09d020e645b06bd4680d Mon Sep 17 00:00:00 2001 From: Joris Date: Sat, 9 Sep 2023 13:50:17 +0200 Subject: Allow to open book detail in modal --- src/view/components/modal.ts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/view/components/modal.ts (limited to 'src/view/components/modal.ts') diff --git a/src/view/components/modal.ts b/src/view/components/modal.ts new file mode 100644 index 0000000..fe08272 --- /dev/null +++ b/src/view/components/modal.ts @@ -0,0 +1,26 @@ +import { h, Html } from 'lib/rx' + +interface Params { + content: Html, + onClose: () => void +} + +export function view({ content, onClose }: Params): Html { + return h('div', + { className: 'g-Modal', + onclick: () => onClose() + }, + h('div', + { className: 'g-Modal__Content', + onclick: (e: Event) => e.stopPropagation() + }, + h('button', + { className: 'g-Modal__Close', + onclick: () => onClose() + }, + '✖' + ), + content + ) + ) +} -- cgit v1.2.3