From 38accab784cf91263473299bc496d63d2746430b Mon Sep 17 00:00:00 2001 From: sutigit Date: Mon, 3 Feb 2025 10:58:36 +0200 Subject: [PATCH] add initial filters --- .../V1/Generic/FacultySelectComponent.tsx | 84 +++++++++++++++++++ .../V1/Generic/LevelSelectComponent.tsx | 83 ++++++++++++++++++ .../V1/Generic/YearSelectComponent.tsx | 83 ++++++++++++++++++ client/components/V1/Overview/index.tsx | 6 ++ 4 files changed, 256 insertions(+) create mode 100644 client/components/V1/Generic/FacultySelectComponent.tsx create mode 100644 client/components/V1/Generic/LevelSelectComponent.tsx create mode 100644 client/components/V1/Generic/YearSelectComponent.tsx diff --git a/client/components/V1/Generic/FacultySelectComponent.tsx b/client/components/V1/Generic/FacultySelectComponent.tsx new file mode 100644 index 00000000..83f0801b --- /dev/null +++ b/client/components/V1/Generic/FacultySelectComponent.tsx @@ -0,0 +1,84 @@ +import * as React from 'react'; +import { Theme, useTheme } from '@mui/material/styles'; +import OutlinedInput from '@mui/material/OutlinedInput'; +import MenuItem from '@mui/material/MenuItem'; +import FormControl from '@mui/material/FormControl'; +import Select, { SelectChangeEvent } from '@mui/material/Select'; + +const ITEM_HEIGHT = 48; +const ITEM_PADDING_TOP = 8; +const MenuProps = { + PaperProps: { + style: { + maxHeight: ITEM_HEIGHT * 4.5 + ITEM_PADDING_TOP, + width: 250, + }, + }, +}; + +const faculties = [ + 'Matemaattis-luonnontieteellinen', + 'Humanistinen', + 'Oikeustieteellinen', +]; + +const getStyles = (faculty: string, facultyName: readonly string[], theme: Theme) => { + return { + fontWeight: facultyName.includes(faculty) + ? theme.typography.fontWeightMedium + : theme.typography.fontWeightRegular, + }; +} + +const FacultySelectComponent = () => { + const theme = useTheme(); + const [facultyName, setPersonName] = React.useState([]); + + const handleChange = (event: SelectChangeEvent) => { + const { + target: { value }, + } = event; + setPersonName( + // On autofill we get a stringified value. + typeof value === 'string' ? value.split(',') : value, + ); + }; + + return ( +
+ + + +
+ ); +} + +export default FacultySelectComponent \ No newline at end of file diff --git a/client/components/V1/Generic/LevelSelectComponent.tsx b/client/components/V1/Generic/LevelSelectComponent.tsx new file mode 100644 index 00000000..bd3d7e90 --- /dev/null +++ b/client/components/V1/Generic/LevelSelectComponent.tsx @@ -0,0 +1,83 @@ +import * as React from 'react'; +import { Theme, useTheme } from '@mui/material/styles'; +import OutlinedInput from '@mui/material/OutlinedInput'; +import MenuItem from '@mui/material/MenuItem'; +import FormControl from '@mui/material/FormControl'; +import Select, { SelectChangeEvent } from '@mui/material/Select'; + +const ITEM_HEIGHT = 48; +const ITEM_PADDING_TOP = 8; +const MenuProps = { + PaperProps: { + style: { + maxHeight: ITEM_HEIGHT * 4.5 + ITEM_PADDING_TOP, + width: 250, + }, + }, +}; + +const levels = [ + 'Kandi', + 'Maisteri', +]; + +const getStyles = (level: string, levelName: readonly string[], theme: Theme) => { + return { + fontWeight: levelName.includes(level) + ? theme.typography.fontWeightMedium + : theme.typography.fontWeightRegular, + }; +} + +const LevelSelectComponent = () => { + const theme = useTheme(); + const [levelName, setLevelName] = React.useState([]); + + const handleChange = (event: SelectChangeEvent) => { + const { + target: { value }, + } = event; + setLevelName( + // On autofill we get a stringified value. + typeof value === 'string' ? value.split(',') : value, + ); + }; + + return ( +
+ + + +
+ ); +} + +export default LevelSelectComponent \ No newline at end of file diff --git a/client/components/V1/Generic/YearSelectComponent.tsx b/client/components/V1/Generic/YearSelectComponent.tsx new file mode 100644 index 00000000..723d1044 --- /dev/null +++ b/client/components/V1/Generic/YearSelectComponent.tsx @@ -0,0 +1,83 @@ +import * as React from 'react'; +import { Theme, useTheme } from '@mui/material/styles'; +import OutlinedInput from '@mui/material/OutlinedInput'; +import MenuItem from '@mui/material/MenuItem'; +import FormControl from '@mui/material/FormControl'; +import Select, { SelectChangeEvent } from '@mui/material/Select'; + +const ITEM_HEIGHT = 48; +const ITEM_PADDING_TOP = 8; +const MenuProps = { + PaperProps: { + style: { + maxHeight: ITEM_HEIGHT * 4.5 + ITEM_PADDING_TOP, + width: 250, + }, + }, +}; + +const years = [ + '2024', + '2025', +]; + +const getStyles = (year: string, personName: readonly string[], theme: Theme) => { + return { + fontWeight: personName.includes(year) + ? theme.typography.fontWeightMedium + : theme.typography.fontWeightRegular, + }; +} + +const YearSelectComponent = () => { + const theme = useTheme(); + const [personName, setPersonName] = React.useState([]); + + const handleChange = (event: SelectChangeEvent) => { + const { + target: { value }, + } = event; + setPersonName( + // On autofill we get a stringified value. + typeof value === 'string' ? value.split(',') : value, + ); + }; + + return ( +
+ + + +
+ ); +} + +export default YearSelectComponent \ No newline at end of file diff --git a/client/components/V1/Overview/index.tsx b/client/components/V1/Overview/index.tsx index 76162048..9ca05841 100644 --- a/client/components/V1/Overview/index.tsx +++ b/client/components/V1/Overview/index.tsx @@ -1,6 +1,9 @@ import { useLocation } from "react-router" import DataComponent from "./DataComponent" +import YearSelectComponent from "../Generic/YearSelectComponent" +import FacultySelectComponent from "../Generic/FacultySelectComponent" +import LevelSelectComponent from "../Generic/LevelSelectComponent" const OverviewPage = () => { const location = useLocation() @@ -18,6 +21,9 @@ const OverviewPage = () => {

VUOSISEURANTA

{/* Filters */} + + +