Skip to content

Commit

Permalink
Fix plus button
Browse files Browse the repository at this point in the history
  • Loading branch information
jacoblurie29 committed Apr 12, 2024
1 parent 0c03768 commit 98cf7ec
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 26 deletions.
11 changes: 8 additions & 3 deletions src/pages/PassengersPage/PassengersPage.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
import styles from "./PassengersPage.module.css";
import PatientCard from "./components/PatientCard/PatientCard";
import PassengerCard from "./components/PassengerCard/PassengerCard";
import PlusButton from "./components/AddPassengerModal/PlusButton";
import PlusButton from "./components/PlusButton/PlusButton";
import AddPassengerModal from "./components/AddPassengerModal/AddPassengerModal";
import { getAccompanyingPassengers, getPassengers } from "../../api/queries";
import { useUserContext } from "../../context/User.context";
import { useNavigationContext } from "../../context/Navigation.context";
import { Tabs } from "../../layout/SideBar/SideBar.definitions";
import { useQuery } from "@tanstack/react-query";
import { useAuth } from "@clerk/clerk-react";
import { useEffect } from "react";
import { useEffect, useState } from "react";
import type { PassengerData } from "../../interfaces/passenger.interface";

const PassengersPage = () => {
const { getToken } = useAuth();
const { currentUser } = useUserContext();
const { setCurrentTab } = useNavigationContext();
const [isModalOpen, setIsModalOpen] = useState(false);

// ping the getUserByID endpoint to get the user's data
const { data: passengerData, isLoading: passengerLoading } =
Expand Down Expand Up @@ -56,6 +58,9 @@ const PassengersPage = () => {

return (
<>
{isModalOpen && (
<AddPassengerModal onClose={() => setIsModalOpen(false)} />
)}
<div className={styles.container}>
<div className={styles.patientSection}>
<h2 className={styles.header}>Patients and Companions</h2>
Expand All @@ -69,7 +74,7 @@ const PassengersPage = () => {
<h3 className={styles.subheader}>
Companion Information
<div className={styles.plusButton}>
<PlusButton />
<PlusButton setOpen={setIsModalOpen} />
</div>{" "}
</h3>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ const AddPassengerModal: React.FC<AddPassengerModalProps> = ({ onClose }) => {

return (
<Modal
action={onClose}
action={() => onClose()}
header="Add Passenger"
body={
<form onSubmit={handleSubmit(onSubmit)} className={styles.inputList}>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.container {
display: flex;
justify-content: center;
align-items: center;
width: 30px;
height: 30px;
border-radius: 50%;
background-color: #d2d2d2;
cursor: pointer;
transition: background-color 0.3s;
}

.container:hover {
background-color: #a9a9a9;
cursor: pointer;
}

.icon {
font-size: 1rem;
color: #ffffff;
}
14 changes: 14 additions & 0 deletions src/pages/PassengersPage/components/PlusButton/PlusButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import styles from "./PlusButton.module.css";

import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faPlus } from "@fortawesome/free-solid-svg-icons";

const PlusButton = ({ setOpen }: { setOpen: (_open: boolean) => void }) => {
return (
<div className={styles.container} onClick={() => setOpen(true)}>
<FontAwesomeIcon icon={faPlus} className={styles.icon} />
</div>
);
};

export default PlusButton;

0 comments on commit 98cf7ec

Please sign in to comment.