Skip to content

Commit

Permalink
Merge pull request #750 from DTS-STN/default-param
Browse files Browse the repository at this point in the history
Fix alerts not appearing
  • Loading branch information
jhslater authored Nov 8, 2024
2 parents 3f33b91 + 6bd269b commit f11d0cc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 22 deletions.
2 changes: 2 additions & 0 deletions __tests__/components/Card.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,6 @@ describe('Card', () => {
const results = await axe(container)
expect(results).toHaveNoViolations()
})

// TODO: Add a test that if an alert is added it actually appears
})
39 changes: 17 additions & 22 deletions components/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ const Card = ({
alert_icon_id: '',
},
],
hasAlert,
locale,
cardTitle,
viewMoreLessCaption,
Expand Down Expand Up @@ -111,27 +110,23 @@ const Card = ({
/>
{!isOpen ? null : (
<div>
{hasAlert &&
cardAlert.map((alert, index) => {
const alertType = alert.type[0].split('/').pop()
return (
<ul
className="w-full pb-3 sm:px-8 sm:pb-6 md:px-15"
key={index}
>
<ContextualAlert
id={alert.id}
type={alertType}
alertHeading={alert.alertHeading}
alertBody={alert.alertBody}
alert_icon_alt_text={`${alertType} ${
locale === 'fr' ? 'Icônes' : 'icon'
}`}
alert_icon_id={` alert-icon ${alert.id}`}
/>
</ul>
)
})}
{cardAlert.map((alert, index) => {
const alertType = alert.type[0].split('/').pop()
return (
<ul className="w-full pb-3 sm:px-8 sm:pb-6 md:px-15" key={index}>
<ContextualAlert
id={alert.id}
type={alertType}
alertHeading={alert.alertHeading}
alertBody={alert.alertBody}
alert_icon_alt_text={`${alertType} ${
locale === 'fr' ? 'Icônes' : 'icon'
}`}
alert_icon_id={` alert-icon ${alert.id}`}
/>
</ul>
)
})}
<div className="pb-6" data-cy="sectionList">
{children}
</div>
Expand Down

0 comments on commit f11d0cc

Please sign in to comment.