2024-07-22 13:57:04 +00:00
|
|
|
import { createEffect, type ParentComponent } from "solid-js";
|
2024-08-05 07:33:00 +00:00
|
|
|
import styles from "./BottomSheet.module.css";
|
2024-07-22 13:57:04 +00:00
|
|
|
|
|
|
|
export type BottomSheetProps = {
|
|
|
|
open?: boolean;
|
|
|
|
};
|
|
|
|
|
|
|
|
const BottomSheet: ParentComponent<BottomSheetProps> = (props) => {
|
|
|
|
let element: HTMLDialogElement;
|
|
|
|
|
|
|
|
createEffect(() => {
|
|
|
|
if (props.open) {
|
|
|
|
if (!element.open) {
|
|
|
|
element.showModal();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (element.open) {
|
|
|
|
element.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2024-08-05 07:33:00 +00:00
|
|
|
return (
|
|
|
|
<dialog class={styles.bottomSheet} ref={element!}>
|
|
|
|
{props.children}
|
|
|
|
</dialog>
|
|
|
|
);
|
2024-07-22 13:57:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export default BottomSheet;
|