Skip to content

Commit

Permalink
feat: Added dropdown for client view (#71)
Browse files Browse the repository at this point in the history
Co-authored-by: Rudra Patel <patelrudra2003@gmail.com>
  • Loading branch information
luongkelly and RudraPatel2003 authored Dec 17, 2024
1 parent 39910c8 commit be27830
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/components/ProgramSectionDropdown/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { Box, FormControl, MenuItem, Select, Typography } from "@mui/material";
import { SelectChangeEvent } from "@mui/material/Select";
import React, { useState } from "react";

import HealthyHabitsForm from "@/components/HealthyHabitsForm";

export default function ProgramSectionDropdown() {
const [selectedSection, setSelectedSection] = useState<string>("history");

const handleChange = (event: SelectChangeEvent<string>) => {
setSelectedSection(event.target.value);
};

return (
<Box sx={{ marginTop: 2 }}>
{/* Dropdown */}
<FormControl sx={{ m: 1, minWidth: 120 }}>
<Select
labelId="section-dropdown-label"
id="section-dropdown"
value={selectedSection}
onChange={handleChange}
>
<MenuItem value="history">History</MenuItem>
<MenuItem value="track">Track</MenuItem>
<MenuItem value="info">Info</MenuItem>
</Select>
</FormControl>

{/* Content Based on Selection */}
<Box sx={{ marginTop: 3 }}>
{selectedSection === "history" && <Typography>History</Typography>}
{selectedSection === "track" && <HealthyHabitsForm />}
{selectedSection === "info" && <Typography>Info</Typography>}
</Box>
</Box>
);
}

0 comments on commit be27830

Please sign in to comment.