Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix alerts not appearing #750

Merged
merged 1 commit into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading