From 98c87787db3d16548b616fa890bab131263d4a47 Mon Sep 17 00:00:00 2001 From: Nick Tchayka Date: Wed, 6 Sep 2023 15:19:23 +0100 Subject: Add modal --- docusaurus.config.js | 6 ------ src/components/Button.tsx | 9 ++++++-- src/components/Dialog.tsx | 15 +++++++------ src/components/Modal.tsx | 55 +++++++++++++++++++++++++++++++++++++++++++++++ src/css/custom.css | 3 ++- src/pages/index.tsx | 24 +++++++++++++++++++++ tailwind.config.js | 3 +++ 7 files changed, 99 insertions(+), 16 deletions(-) create mode 100644 src/components/Modal.tsx diff --git a/docusaurus.config.js b/docusaurus.config.js index 4d821c8..69afc6e 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -81,12 +81,6 @@ const config = { disableSwitch: true, respectPrefersColorScheme: false, }, - announcementBar: { - content: ` - Greetings traveller! You probably found this site by accident. It is far from finished, but if you\'re curious about the project, join the Discord server and say hello! - `, - isCloseable: false, - }, navbar: { title: "NeoHaskell", logo: { diff --git a/src/components/Button.tsx b/src/components/Button.tsx index 8d2d6db..90d44f6 100644 --- a/src/components/Button.tsx +++ b/src/components/Button.tsx @@ -15,19 +15,23 @@ type ButtonType = { | "cyan" | ""; disabled?: boolean; + onClick?: () => void; + className?: string; }; const Button = ({ children, - rounded = "none", + onClick = () => {}, + rounded = "full", size = "md", color = "cyan", disabled, + className, }: ButtonType) => { return ( )} {actionButtonText && ( )} diff --git a/src/components/Modal.tsx b/src/components/Modal.tsx new file mode 100644 index 0000000..55ad174 --- /dev/null +++ b/src/components/Modal.tsx @@ -0,0 +1,55 @@ +import React from "react"; +import Button from "./Button"; + +export interface ModalProps { + title: string | React.ReactNode; + children: React.ReactNode; + open: boolean; + okText?: string; + cancelText?: string; + onOk?: () => void; + onCancel?: () => void; +} + +export default function Modal({ + title, + children, + open, + okText = "OK", + cancelText, + onOk = () => {}, + onCancel = () => {}, +}: ModalProps) { + return ( + open && ( +
+
+
+
+

{title}

+
+ {children} +
+
+ {cancelText && ( + + )} + {okText && ( + + )} +
+
+
+
+
+ ) + ); +} diff --git a/src/css/custom.css b/src/css/custom.css index 11c4b29..38cf792 100644 --- a/src/css/custom.css +++ b/src/css/custom.css @@ -15,7 +15,7 @@ letter-spacing: -0.095em; } -.announcementBar_node_modules-\@docusaurus-theme-classic-lib-theme-AnnouncementBar-styles-module { +/*#announcementBar { @apply h-60 !important; @apply m-7; @apply p-7; @@ -27,6 +27,7 @@ @apply shadow-neoyellow; font-family: 'Lexend Mega', sans-serif; } +*/ .close { opacity: 1 !important; diff --git a/src/pages/index.tsx b/src/pages/index.tsx index ae3e0bf..a8fb16d 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -10,6 +10,8 @@ import styles from "./index.module.css"; import Frame from "../components/Frame"; import Button from "../components/Button"; import CodeFrame from "../components/CodeFrame"; +import Dialog from "../components/Dialog"; +import Modal from "../components/Modal"; const dynC = (className: string, color: string) => `dark:${className}-dark${color} ${className}-light${color}`; @@ -53,8 +55,30 @@ function HomepageHeader() { export default function Home(): JSX.Element { const { siteConfig } = useDocusaurusContext(); + const [disclaimerOpen, setDisclaimerOpen] = React.useState(true); + const message = ""; return (
+
+ setDisclaimerOpen(!disclaimerOpen)} + title="Greetings traveller!" + > + You probably found this site by accident. It is far from finished, but + if you're curious about the project.{" "} + It's dangerous to go alone! + setDisclaimerOpen(!disclaimerOpen)} + > +

JOIN THE DISCORD SERVER!

+
+
+
diff --git a/tailwind.config.js b/tailwind.config.js index 5a50e5e..b0639a8 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -55,6 +55,9 @@ module.exports = { neoyellow: borderedShadow(8, colors.yellow["400"]), neoviolet: borderedShadow(8, colors.violet["400"]), }, + zIndex: { + 999: 999, + }, colors: { codeBg: "#2D2A55", ...light, -- cgit