diff --git a/frontend/src/components/Dropdown.module.css b/frontend/src/components/Dropdown.module.css index f88d5fa..0bbd0e6 100644 --- a/frontend/src/components/Dropdown.module.css +++ b/frontend/src/components/Dropdown.module.css @@ -1,53 +1,26 @@ -.dropDown { - cursor: pointer; - background-color: white; - font-size: 16px; - color: var(--color-ccidc-placeholder); - height: 40px; - width: 460px; - border-radius: 4px; - border: 1px solid #d8d8d8; +.select { + padding: 0.5rem 1rem; + width: 100%; background-image: url("../assets/dropDownIcon.svg"); background-repeat: no-repeat, repeat; background-position: right 0.7em top 50%, 0 0; -} - -.dpContent { - position: relative; - top: 25%; - width: 100%; - background: white; - gap: 1em; - border: 1px solid #d8d8d8; - font-size: 16px; -} - -.dpItem { - padding: 10px; - border: 0.5px solid #d8d8d8; - color: black; - cursor: pointer; -} - -.selectOne { - margin-left: 15px; - margin-top: 10px; -} + font: var(--font-body); + border-color: #d8d8d8; + border-radius: 0.25rem; -.selectedOption { - color: black; - margin-left: 15px; - margin-top: 10px; + /* hide arrow for Firefox */ + -moz-appearance: none; + /* hide arrow for Chrome */ + -webkit-appearance: none; } -.dpItem:hover { - background-color: #ebebeb; +/* hide arrow for IE10 */ +.select::-ms-expand { + display: none; } -@media (max-width: 1250px) { - .dropDown { - width: 330px; - } +.select.unselected { + color: #b4b4b4; } diff --git a/frontend/src/components/Dropdown.tsx b/frontend/src/components/Dropdown.tsx index acfd1d1..9f37abf 100644 --- a/frontend/src/components/Dropdown.tsx +++ b/frontend/src/components/Dropdown.tsx @@ -2,55 +2,49 @@ import { useState } from "react"; import styles from "./Dropdown.module.css"; -export function Dropdown(props: { +type DropdownProps = { options: string[]; - onSelect: (value: string) => void; + onSelect?: (value: string) => void; required?: boolean; -}) { - const [selected, setSelected] = useState("Select One"); - const [isActive, setIsActive] = useState(false); +}; - const handleOptionClick = (option: string) => { +export function Dropdown(props: DropdownProps) { + const { options, onSelect, required } = props; + + // default value must be "" for required prop to work, https://stackoverflow.com/a/6048891 + const defaultSelected = ""; + + const [selected, setSelected] = useState(defaultSelected); + + function onSelectChange(event: React.FormEvent) { + const element = event.target as HTMLSelectElement; + const option = element.value; setSelected(option); - setIsActive(false); - props.onSelect(option); - }; + if (onSelect) onSelect(option); + } return ( -
{ - setIsActive(!isActive); - }} - role="button" - tabIndex={0} - onKeyDown={() => { - setIsActive(!isActive); - }} + ); } diff --git a/frontend/src/components/Step1.tsx b/frontend/src/components/Step1.tsx index c83dc16..f9333fe 100644 --- a/frontend/src/components/Step1.tsx +++ b/frontend/src/components/Step1.tsx @@ -13,16 +13,6 @@ type Step1Props = { export function Step1({ onSubmit }: Step1Props) { const [email, setEmail] = useState(""); const [confirmEmail, setConfirmEmail] = useState(""); - const [gender, setGender] = useState(""); - const [phoneType, setPhoneType] = useState(""); - - const handleGenderSelect = (option: string) => { - setGender(option); - }; - - const handlePhoneSelect = (option: string) => { - setPhoneType(option); - }; const handleConfirmEmailChange = (e: React.ChangeEvent) => { setConfirmEmail(e.target.value); @@ -144,15 +134,7 @@ export function Step1({ onSubmit }: Step1Props) {
@@ -185,15 +167,7 @@ export function Step1({ onSubmit }: Step1Props) {
diff --git a/frontend/src/components/Step2.tsx b/frontend/src/components/Step2.tsx index d326162..10d4198 100644 --- a/frontend/src/components/Step2.tsx +++ b/frontend/src/components/Step2.tsx @@ -289,12 +289,6 @@ function ProfessionalAssociationSection() { } function NationalExamSection() { - const [exam, setExam] = useState(""); - - const handleExamSelect = (option: string) => { - setExam(option); - }; - return (
@@ -310,15 +304,7 @@ function NationalExamSection() { className={`${styles.inputTitle} ${styles.dropdownLabel}`} > National Exam* - - +
@@ -359,11 +345,6 @@ function NationalExamSection() { function ICCCourses() { const [courses, setCourses] = useState([{ id: 1 }]); - const [courseSelect, setCourseSelect] = useState(""); - - const handleCourseSelect = (option: string) => { - setCourseSelect(option); - }; const addCourse = () => { setCourses((prevCourses) => [...prevCourses, { id: prevCourses.length + 1 }]); @@ -418,16 +399,7 @@ function ICCCourses() { > Courses * - - {/* Add if dropDown Required */} - +
diff --git a/frontend/src/components/Step4.module.css b/frontend/src/components/Step4.module.css index 7782cc9..1ccfaff 100644 --- a/frontend/src/components/Step4.module.css +++ b/frontend/src/components/Step4.module.css @@ -11,15 +11,8 @@ padding-bottom: 30px; } -@media (max-width: 1300px) { - .formRow { - display: flex; - flex-direction: column; - align-items: center; - } - .formRow .input { - width: 330px; - } +.formRow .dropdownContainer { + width: 460px; } .sectionTitle { @@ -65,6 +58,21 @@ color: var(--color-ccidc-placeholder); } +@media (max-width: 1300px) { + .formRow { + display: flex; + flex-direction: column; + align-items: center; + } + .formRow .input { + width: 330px; + } + + .formRow .dropdownContainer { + width: 330px; + } +} + .line { border: 0.5px solid #d8d8d8; margin-top: 30px; diff --git a/frontend/src/components/Step4.tsx b/frontend/src/components/Step4.tsx index 2fb1240..eacc6f0 100644 --- a/frontend/src/components/Step4.tsx +++ b/frontend/src/components/Step4.tsx @@ -91,16 +91,9 @@ export const Step4: React.FC = ({ next }: StepProps) => {
diff --git a/frontend/src/components/Steps.module.css b/frontend/src/components/Steps.module.css index c6ec40b..ce4976d 100644 --- a/frontend/src/components/Steps.module.css +++ b/frontend/src/components/Steps.module.css @@ -229,11 +229,3 @@ ul { .dropdownLabel { position: relative; } -.customDropDown { - position: absolute; - bottom: 0.5rem; - left: 0.5rem; - /* Forcefully hide */ - opacity: 0; - pointer-events: none; -} diff --git a/frontend/src/pages/index.ts b/frontend/src/pages/index.ts index bb0d988..aa4ab4f 100644 --- a/frontend/src/pages/index.ts +++ b/frontend/src/pages/index.ts @@ -2,15 +2,6 @@ import { Application } from "./Application.tsx"; import { Candidates } from "./Candidates.tsx"; import { Login } from "./Login.tsx"; import { PrescreeningForm } from "./PrescreeningForm.tsx"; -import { TestCongratulations } from "./TestCongratulations.tsx"; import { TestModals } from "./TestModals.tsx"; import { ThankyouForApplying } from "./ThankyouForApplying.tsx"; -export { - Application, - Candidates, - TestCongratulations, - ThankyouForApplying, - PrescreeningForm, - Login, - TestModals, -}; +export { Application, Candidates, ThankyouForApplying, PrescreeningForm, Login, TestModals };