import classNames from 'classnames';
import React, { useContext } from 'react';
import AnsweringInstructions from '../AnsweringInstructions';
import NotificationIcon from '../NotificationIcon';
import { QuestionContext } from '../context/QuestionContext';
import { Score } from '../shared/Score';
import { formatQuestionDisplayNumber } from '../../formatting';
import { questionTitleId } from '../../ids';
const QuestionTitle = ({ element, renderChildNodes }) => {
    const { displayNumber, maxScore, level, maxAnswers, childQuestions } = useContext(QuestionContext);
    const Tag = `h${Math.min(3 + level, 6)}`;
    const id = questionTitleId(displayNumber);
    return (React.createElement(React.Fragment, null,
        React.createElement(Tag, { id: id, className: classNames('exam-question-title', { 'e-normal e-font-size-m': level > 0 }) },
            React.createElement("strong", { className: classNames('exam-question-title__display-number', {
                    'exam-question-title__display-number--indented': level > 0
                }) }, `${formatQuestionDisplayNumber(displayNumber)} `),
            renderChildNodes(element),
            " ",
            React.createElement(Score, { score: maxScore, size: level === 0 ? 'large' : 'small' })),
        maxAnswers != null && childQuestions.length > 0 && (React.createElement("p", { className: "e-italic" },
            React.createElement(NotificationIcon, null),
            React.createElement(AnsweringInstructions, { maxAnswers, childQuestions, elementType: 'question' })))));
};
export default React.memo(QuestionTitle);
//# sourceMappingURL=QuestionTitle.js.map