-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added dropdown for client view (#71)
Co-authored-by: Rudra Patel <patelrudra2003@gmail.com>
- Loading branch information
1 parent
39910c8
commit be27830
Showing
1 changed file
with
38 additions
and
0 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
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> | ||
); | ||
} |