Skip to content

Commit

Permalink
feat(strapi-cms): Adds support for using a modal header
Browse files Browse the repository at this point in the history
  • Loading branch information
relyks committed Aug 9, 2023
1 parent 40d7d30 commit 05f1d34
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 15 deletions.
19 changes: 15 additions & 4 deletions static/js/Misc.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2208,7 +2208,18 @@ const InterruptingMessage = ({
</div>
<div id="interruptingMessageContent">
<div id="highHolidayDonation">
<InterfaceText markdown={replaceNewLinesWithLinebreaks(strapi.modal.modalText)} styleClasses={['line-break']} />
{strapi.modal.modalHeader.en && (
<h4 className="int-en">{strapi.modal.modalHeader.en}</h4>
)}
{strapi.modal.modalHeader.he && (
<h4 className="int-he">{strapi.modal.modalHeader.he}</h4>
)}
<InterfaceText
markdown={replaceNewLinesWithLinebreaks(
strapi.modal.modalText
)}
styleClasses={["line-break"]}
/>
<div className="buttons">
<a
className="button int-en"
Expand All @@ -2227,9 +2238,9 @@ const InterruptingMessage = ({
target="_blank"
href={strapi.modal.buttonURL.he}
onClick={() => {
closeModal("donate_button_clicked");
}}
>
closeModal("donate_button_clicked");
}}
>
<span className="int-he">
{strapi.modal.buttonText.he}
</span>
Expand Down
3 changes: 0 additions & 3 deletions static/js/ReaderApp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2183,9 +2183,6 @@ toggleSignUpModal(modalContentKind = SignUpModalKind.Default) {
classDict[interfaceLangClass] = true;
var classes = classNames(classDict);

// const strapi = useContext(StrapiDataContext);
// const { interruptingMessageModal } = useContext(StrapiDataContext);

return (
<StrapiDataProvider>
<AdContext.Provider value={this.getUserContext()}>
Expand Down
21 changes: 13 additions & 8 deletions static/js/context.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,14 @@ function StrapiDataProvider({ children }) {
locale
buttonText
buttonURL
modalHeader
modalText
}
}
}
modalEndDate
modalStartDate
modalHeader
modalText
publishedAt
shouldDeployOnMobile
Expand Down Expand Up @@ -218,14 +220,17 @@ function StrapiDataProvider({ children }) {
});
modal.attributes.locales = ["en", "he"];
} else {
["modalText", "buttonText", "buttonURL"].forEach(
(attribute) => {
modal.attributes[attribute] = {
en: modal.attributes[attribute],
he: null,
};
}
);
[
"modalHeader",
"modalText",
"buttonText",
"buttonURL",
].forEach((attribute) => {
modal.attributes[attribute] = {
en: modal.attributes[attribute],
he: null,
};
});
modal.attributes.locales = ["en"];
}
setModal(modal.attributes);
Expand Down

0 comments on commit 05f1d34

Please sign in to comment.