From 9b6a7165e692e34705f9bb8f6117d417a2c27193 Mon Sep 17 00:00:00 2001 From: Max Chopart Date: Tue, 23 Apr 2024 18:41:19 +0200 Subject: [PATCH] [Upd #193] Refactoring messages with new intl provider --- src/components/Question.jsx | 7 ++----- src/stories/Question.stories.tsx | 3 --- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/components/Question.jsx b/src/components/Question.jsx index acfff3fe..4f121fcf 100644 --- a/src/components/Question.jsx +++ b/src/components/Question.jsx @@ -442,12 +442,9 @@ export default class Question extends React.Component { } _renderCollapseToggle() { - const { options } = this.context; - - // TODO: Convert this component into a functional component to use useIntl() Hook const title = this.state.expanded - ? options.i18n["section.collapse"] - : options.i18n["section.expand"]; + ? this.props.intl.formatMessage({ id: "section.collapse" }) + : this.props.intl.formatMessage({ id: "section.expand" }); return ( diff --git a/src/stories/Question.stories.tsx b/src/stories/Question.stories.tsx index 185f30c5..f509b952 100644 --- a/src/stories/Question.stories.tsx +++ b/src/stories/Question.stories.tsx @@ -37,7 +37,6 @@ const optionsWithDebugModeOn = { intl: { locale: "en", }, - i18n: {}, debugMode: true, }; @@ -45,7 +44,6 @@ const optionsWithStartingHiddenQuestion = { intl: { locale: "en", }, - i18n: {}, ...getP("startingQuestionId", "hidden-question-1834"), }; @@ -66,7 +64,6 @@ const Template: ComponentStory = ( intl: { locale: "en", }, - i18n: {}, debugMode: debugMode, }; const _getComponentMappingFunction = () => {