This repository has been archived by the owner on Dec 19, 2024. It is now read-only.
-
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 #70 from brown-ccv/feat-pubs-styling
feat: pubs page styling
- Loading branch information
Showing
14 changed files
with
132 additions
and
195 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
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 |
---|---|---|
|
@@ -3,9 +3,9 @@ import * as Dialog from "@radix-ui/react-dialog" | |
import * as Form from "@radix-ui/react-form" | ||
import { Cross2Icon, DownloadIcon, PlusIcon } from "@radix-ui/react-icons" | ||
import { useForm, Controller, type SubmitHandler } from "react-hook-form" | ||
import { CustomInput } from "./CustomInput.tsx" | ||
import { CustomTextarea } from "./CustomTextarea.tsx" | ||
import { Textarea } from "./Textarea.tsx" | ||
import Button from "./Button.tsx" | ||
import { Input } from "./Input.tsx" | ||
|
||
export interface Inputs { | ||
name: string | ||
|
@@ -65,41 +65,44 @@ const DownloadModal: React.FC<DownloadModalProps> = ({ filesToDownload }) => { | |
name="name" | ||
control={control} | ||
render={() => ( | ||
<CustomInput label="Name" placeholder="Heather Yu" {...register("name")} /> | ||
<Input label="Name" placeholder="Heather Yu" {...register("name")} required /> | ||
)} | ||
/> | ||
<Controller | ||
name="institution" | ||
control={control} | ||
render={() => ( | ||
<CustomInput | ||
<Input | ||
label="Institution" | ||
placeholder="Brown University" | ||
{...register("institution")} | ||
required | ||
/> | ||
)} | ||
/> | ||
<Controller | ||
name="email" | ||
control={control} | ||
render={() => ( | ||
<CustomInput | ||
<Input | ||
label="Email" | ||
placeholder="[email protected]" | ||
match="typeMismatch" | ||
errorMessage="Please provide a valid email" | ||
{...register("email")} | ||
required | ||
/> | ||
)} | ||
/> | ||
<Controller | ||
name="description" | ||
control={control} | ||
render={() => ( | ||
<CustomTextarea | ||
<Textarea | ||
label="Description" | ||
placeholder="Why you need this file..." | ||
{...register("description")} | ||
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
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,34 @@ | ||
import * as Form from "@radix-ui/react-form" | ||
import React, { type ReactNode } from "react" | ||
|
||
interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> { | ||
label: string | ||
name: string | ||
icon?: ReactNode | ||
match?: Form.FormMessageProps["match"] | ||
errorMessage?: string | ||
} | ||
|
||
export const Input = React.forwardRef<HTMLInputElement, InputProps>( | ||
({ label, name, icon, match, errorMessage, ...delegated }: InputProps, ref) => { | ||
return ( | ||
<Form.Field name={name} className="flex flex-col gap-2"> | ||
<Form.Label>{label}</Form.Label> | ||
<Form.Control asChild> | ||
<div className="flex items-center gap-2 bg-white rounded-full shadow-inner min-w-60 w-max py-3 px-5 focus-within:shadow-inner-focus"> | ||
<span className="text-neutral-300 w-5 h-5">{icon}</span> | ||
<input {...delegated} ref={ref} /> | ||
</div> | ||
</Form.Control> | ||
<Form.Message className="text-primary-300" match="valueMissing"> | ||
Please enter your {label} | ||
</Form.Message> | ||
{match !== undefined && ( | ||
<> | ||
<Form.Message match={match}>{errorMessage}</Form.Message> | ||
</> | ||
)} | ||
</Form.Field> | ||
) | ||
} | ||
) |
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,26 @@ | ||
import React from "react" | ||
import * as Form from "@radix-ui/react-form" | ||
|
||
interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> { | ||
label: string | ||
name: string | ||
} | ||
|
||
export const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>( | ||
({ name, label, ...delegated }, ref) => ( | ||
<Form.Field name={name} className="flex flex-col gap-2"> | ||
<Form.Label>{label}</Form.Label> | ||
<Form.Control asChild> | ||
<textarea | ||
rows={4} | ||
className="text-gray-400 text-sm font-medium outline-none border-b-2 w-full" | ||
{...delegated} | ||
ref={ref} | ||
/> | ||
</Form.Control> | ||
<Form.Message className="text-primary-300" match="valueMissing"> | ||
Please enter your {label} | ||
</Form.Message> | ||
</Form.Field> | ||
) | ||
) |
Oops, something went wrong.