generated from sindresorhus/node-module-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
34 additions
and
36 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,42 @@ | ||
import type { MetaFunction } from "@remix-run/node"; | ||
|
||
import { useModal } from "@gsong/react-modal-dialog"; | ||
|
||
export const meta: MetaFunction = () => { | ||
return [ | ||
{ title: "New Remix App" }, | ||
{ name: "description", content: "Welcome to Remix!" }, | ||
{ title: "Modal Demo" }, | ||
{ name: "description", content: "@gsong/react-modal-dialog demo" }, | ||
]; | ||
}; | ||
|
||
export default function Index() { | ||
const { Modal, openModal, closeModal } = useModal(); | ||
|
||
return ( | ||
<div className="font-sans p-4"> | ||
<h1 className="text-3xl">Welcome to Remix</h1> | ||
<ul className="list-disc mt-4 pl-6 space-y-2"> | ||
<li> | ||
<a | ||
className="text-blue-700 underline visited:text-purple-900" | ||
target="_blank" | ||
href="https://remix.run/start/quickstart" | ||
rel="noreferrer" | ||
> | ||
5m Quick Start | ||
</a> | ||
</li> | ||
<li> | ||
<a | ||
className="text-blue-700 underline visited:text-purple-900" | ||
target="_blank" | ||
href="https://remix.run/start/tutorial" | ||
rel="noreferrer" | ||
> | ||
30m Tutorial | ||
</a> | ||
</li> | ||
<li> | ||
<a | ||
className="text-blue-700 underline visited:text-purple-900" | ||
target="_blank" | ||
href="https://remix.run/docs" | ||
rel="noreferrer" | ||
> | ||
Remix Docs | ||
</a> | ||
</li> | ||
</ul> | ||
<div style={{ height: "200vh" }}> | ||
<button | ||
onClick={openModal} | ||
className="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded" | ||
> | ||
Open Modal | ||
</button> | ||
|
||
<Modal | ||
allowBodyScroll | ||
allowDismiss | ||
onDismiss={() => console.debug("Dismissed")} | ||
onCancel={() => console.debug("Canceled")} | ||
onClose={() => console.debug("Closed")} | ||
className="bg-white rounded-lg shadow-xl p-6 w-full max-w-md mx-auto space-y-4" | ||
> | ||
<div className="text-lg font-semibold mb-2">Modal content</div> | ||
<button | ||
onClick={closeModal} | ||
className="bg-gray-500 hover:bg-gray-700 text-white font-bold py-2 px-4 rounded self-end transition duration-300 ease-in-out" | ||
> | ||
Close Modal | ||
</button> | ||
</Modal> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters