Skip to content

Commit

Permalink
[YearFilter] Convert to TypeScript
Browse files Browse the repository at this point in the history
  • Loading branch information
rikurauhala committed Nov 5, 2024
1 parent 4e74a15 commit 807e5fb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { arrayOf, func, shape } from 'prop-types'
import { Form } from 'semantic-ui-react'
import { DropdownProps, Form } from 'semantic-ui-react'

export const YearFilter = ({ years, fromYear, toYear, handleChange }) => (
interface YearFilterProps {
years: Array<{ key: number; text: string; value: number }>
fromYear: number
toYear: number
handleChange: (event: React.SyntheticEvent, data: DropdownProps) => void
}

export const YearFilter = ({ years, fromYear, toYear, handleChange }: YearFilterProps) => (
<Form>
<Form.Group inline>
<Form.Dropdown
Expand Down Expand Up @@ -31,8 +37,3 @@ export const YearFilter = ({ years, fromYear, toYear, handleChange }) => (
</Form.Group>
</Form>
)

YearFilter.propTypes = {
years: arrayOf(shape({})).isRequired,
handleChange: func.isRequired,
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import { Button, Form, Grid, Header, Popup, Segment } from 'semantic-ui-react'

import { ProgrammeDropdown } from '@/components/CourseStatistics/ProgrammeDropdown'
import { ResultTabs } from '@/components/CourseStatistics/ResultTabs'
import { YearFilter } from '@/components/CourseStatistics/SearchForm/YearFilter'
import { useLanguage } from '@/components/LanguagePicker/useLanguage'
import { useGetMaxYearsToCreatePopulationFromQuery } from '@/redux/populations'
import { useGetSemestersQuery } from '@/redux/semesters'
import { setSelectedCourse, clearSelectedCourse } from '@/redux/singleCourseStats'
import { ALL, getAllStudyProgrammes } from '@/selectors/courseStats'
import { countTotalStats } from './countTotalStats'
import { YearFilter } from './YearFilter'

const countFilteredStudents = (stat, filter) => {
if (!stat) {
Expand Down

0 comments on commit 807e5fb

Please sign in to comment.