-
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.
Merge pull request #35 from brown-ccv/inputs-modal
Modal component
- Loading branch information
Showing
12 changed files
with
277 additions
and
12 deletions.
There are no files selected for viewing
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
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
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 |
---|---|---|
|
@@ -20,4 +20,5 @@ pnpm-debug.log* | |
# macOS-specific files | ||
.DS_Store | ||
.idea | ||
*.log | ||
*.log | ||
*.cache |
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,11 +1,12 @@ | ||
import { defineConfig } from 'astro/config'; | ||
import mdx from '@astrojs/mdx'; | ||
import sitemap from '@astrojs/sitemap'; | ||
|
||
import { defineConfig } from "astro/config"; | ||
import mdx from "@astrojs/mdx"; | ||
import sitemap from "@astrojs/sitemap"; | ||
import tailwind from "@astrojs/tailwind"; | ||
|
||
import react from "@astrojs/react"; | ||
|
||
// https://astro.build/config | ||
export default defineConfig({ | ||
site: 'https://example.com', | ||
integrations: [mdx(), sitemap(), tailwind()] | ||
site: "https://example.com", | ||
integrations: [mdx(), sitemap(), tailwind(), react()] | ||
}); |
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,6 +1,6 @@ | ||
{ | ||
"hosting": { | ||
"public": "public", | ||
"source": ".", | ||
"ignore": [ | ||
"firebase.json", | ||
"**/.*", | ||
|
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
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from "react" | ||
|
||
interface CustomInputProps { | ||
label: string | ||
placeholder: string | ||
} | ||
|
||
export const CustomInput: React.FC<CustomInputProps> = ({ label, placeholder }) => { | ||
return ( | ||
<> | ||
<input | ||
name={label} | ||
id={label} | ||
className="text-gray-400 text-sm font-medium outline-none border-b-2 py-2 w-full my-4 mx-2" | ||
placeholder={placeholder} | ||
required | ||
/> | ||
</> | ||
) | ||
} |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React from "react" | ||
|
||
interface CustomTextareaProps { | ||
label: string | ||
placeholder: string | ||
} | ||
|
||
export const CustomTextarea: React.FC<CustomTextareaProps> = ({ label, placeholder }) => { | ||
return ( | ||
<> | ||
<textarea | ||
rows={4} | ||
id={label} | ||
className="text-gray-400 text-sm font-medium outline-none border-b-2 py-2 w-full my-4 mx-2" | ||
placeholder={placeholder} | ||
/> | ||
</> | ||
) | ||
} |
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import React from "react" | ||
import * as Dialog from "@radix-ui/react-dialog" | ||
import { Cross2Icon, DownloadIcon, PlusIcon } from "@radix-ui/react-icons" | ||
import { CustomInput } from "./CustomInput.tsx" | ||
import { CustomTextarea } from "./CustomTextarea.tsx" | ||
|
||
const DownloadModal = () => { | ||
const [isOpen, setIsOpen] = React.useState(false) | ||
|
||
return ( | ||
<Dialog.Root open={isOpen} onOpenChange={setIsOpen}> | ||
<Dialog.Trigger asChild> | ||
<button className="sm:inline-flex items-center justify-center w-8 h-8 rounded-lg text-sm text-gray-500 hover:bg-gray-100 focus:outline-none focus:ring-4 focus:ring-gray-200"> | ||
<DownloadIcon /> | ||
<span className="sr-only">Download data</span> | ||
</button> | ||
</Dialog.Trigger> | ||
<Dialog.Portal> | ||
<Dialog.Overlay | ||
className="fixed top-0 left-0 right-0 bottom-0 bg-gray-500 bg-opacity-75 transition-opacity z-10 w-screen overflow-y-auto" | ||
onClick={() => setIsOpen(false)} | ||
/> | ||
<Dialog.Overlay className="fixed top-0 left-0 right-0 bottom-0 grid place-items-center z-10 w-screen overflow-y-auto"> | ||
<Dialog.Content className="rounded-lg text-left shadow-xl max-h-fit transition-all bg-white px-4 pb-4 pt-5 sm:p-6 sm:pb-4 sm:my-8 sm:w-full sm:max-w-lg"> | ||
<div className="flex justify-end"> | ||
<Dialog.Close className="text-gray-400 bg-transparent rounded-lg text-sm w-8 h-8 inline-flex justify-center items-center hover:bg-gray-200 hover:text-gray-900"> | ||
<Cross2Icon /> | ||
<span className="sr-only">Close</span> | ||
</Dialog.Close> | ||
</div> | ||
<Dialog.Title>Download Data</Dialog.Title> | ||
<form className="p-4 md:p-5"> | ||
<div className="flex flex-col justify-center mb-4"> | ||
<CustomInput label={"name"} placeholder={"Your name"} /> | ||
<CustomInput label={"institution"} placeholder={"Your institution"} /> | ||
<CustomInput label={"email"} placeholder={"Your email"} /> | ||
<CustomTextarea label={"description"} placeholder={"Why you need this file"} /> | ||
</div> | ||
<div className="flex flex-row gap-2"> | ||
<button className="flex items-center gap-2 rounded-lg px-5 py-2.5 bg-black text-white text-sm text-center font-medium hover:bg-gray-500 focus:ring-4 focus:outline-none focus:ring-gray-500"> | ||
<PlusIcon /> | ||
<span className="pt-1">Validate Email</span> | ||
</button> | ||
<button | ||
type="submit" | ||
disabled | ||
className="flex items-center gap-2 rounded-lg px-5 py-2.5 bg-black text-white text-sm text-center font-medium hover:bg-gray-500 focus:ring-4 focus:outline-none focus:ring-gray-500 disabled:bg-gray-400" | ||
> | ||
Download File | ||
</button> | ||
</div> | ||
</form> | ||
</Dialog.Content> | ||
</Dialog.Overlay> | ||
</Dialog.Portal> | ||
</Dialog.Root> | ||
) | ||
} | ||
export default DownloadModal |
Oops, something went wrong.