Skip to content

Commit

Permalink
Corrected button text, reduced code duplication.
Browse files Browse the repository at this point in the history
  • Loading branch information
willhoward committed Jan 4, 2023
1 parent 70f4dad commit 0625ea5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 33 deletions.
2 changes: 1 addition & 1 deletion components/x-gift-article/src/Buttons.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export default ({
return (
<div className="x-gift-article__buttons">
<button className="x-gift-article__button" type="button" onClick={actions.createEnterpriseUrl}>
Create enterprise link
Create Enterprise Link
</button>
</div>
)
Expand Down
57 changes: 25 additions & 32 deletions components/x-gift-article/src/RadioButtonsSection.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,38 +73,31 @@ export default ({
</label>
)

if (isFreeArticle) {
if (enterpriseEnabled) {
return (
<div
className="o-forms-input o-forms-input--radio-round o-forms-field x-gift-article__radio_buttons"
role="group"
aria-labelledby="article-share-options"
>
<span className="x-gift-article--visually-hidden" id="article-share-options">
Article share options
</span>
{freeToReadField()}
{enterpriseField()}
</div>
)
}

return null
if (!isFreeArticle || enterpriseEnabled) {
return (
<div
className="o-forms-input o-forms-input--radio-round o-forms-field x-gift-article__radio_buttons"
role="group"
aria-labelledby="article-share-options"
>
<span className="x-gift-article--visually-hidden" id="article-share-options">
Article share options
</span>
{isFreeArticle ? (
<>
{freeToReadField()}
{enterpriseField()}
</>
) : (
<>
{enterpriseField()}
{giftField()}
{nonGiftField()}
</>
)}
</div>
)
}

return (
<div
className="o-forms-input o-forms-input--radio-round o-forms-field x-gift-article__radio_buttons"
role="group"
aria-labelledby="article-share-options"
>
<span className="x-gift-article--visually-hidden" id="article-share-options">
Article share options
</span>
{enterpriseField()}
{giftField()}
{nonGiftField()}
</div>
)
return null
}

0 comments on commit 0625ea5

Please sign in to comment.