EvalueTonSavoir/client/src/components/QuestionNavigation/QuestionNavigation.tsx
2025-01-11 02:22:14 -05:00

38 lines
1.1 KiB
TypeScript

import React from 'react';
import { IconButton } from '@mui/material';
import { ChevronLeft, ChevronRight } from '@mui/icons-material';
interface Props {
previousQuestion: () => void;
nextQuestion: () => void;
currentQuestionId: number;
questionsLength: number;
}
const QuestionNavigation: React.FC<Props> = ({
previousQuestion,
nextQuestion,
currentQuestionId,
questionsLength
}) => {
return (
<div className="center-h-align">
<IconButton
onClick={previousQuestion}
disabled={currentQuestionId <= 1}
color="primary"
>
<ChevronLeft />
</IconButton>
<div className="text-lg text-bold">{`Question ${currentQuestionId}/${questionsLength}`}</div>
<IconButton
onClick={nextQuestion}
disabled={currentQuestionId >= questionsLength}
color="primary"
>
<ChevronRight />
</IconButton>
</div>
);
};
export default QuestionNavigation;