-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(LinkCard & ServiceCard): correction clic sur la carte (#3329)
* feat(LinkCard): correction du clic sur la carte * feat(ServiceCard): correction du clic sur la carte * Update src/client/components/features/ServiceCard/Card/ServiceCard.module.scss Co-authored-by: Gauthier Fiorentino <[email protected]> * Update src/client/components/features/ServiceCard/Card/ServiceCard.module.scss Co-authored-by: Gauthier Fiorentino <[email protected]> * Update src/client/components/features/ServiceCard/Card/ServiceCard.module.scss Co-authored-by: Gauthier Fiorentino <[email protected]> * Update src/client/components/ui/Card/Link/LinkCard.tsx Co-authored-by: Gauthier Fiorentino <[email protected]> * Update src/client/components/ui/Card/Link/LinkCard.tsx Co-authored-by: Gauthier Fiorentino <[email protected]> * Update src/client/components/features/ServiceCard/Card/ServiceCard.tsx Co-authored-by: Gauthier Fiorentino <[email protected]> * Update src/client/components/ui/Card/Link/LinkCard.tsx Co-authored-by: Gauthier Fiorentino <[email protected]> * fix(ServiceCard): fix test * fix(LinkCard): correction a11y * fix(test): corrections tests cassés * wip: Fix test peu explicite * wip: Fix le mock du router dans chaque test * refactor: Supprime le FakeLink * refactor: Passe les props du LinkCardTitle au composant * fix: Fix le libellé du lien des LinkCards * fix: Fix title invalide pour les liens internes * tests: Fix les noms des liens dans les tests --------- Co-authored-by: Gauthier Fiorentino <[email protected]>
- Loading branch information
1 parent
4abf273
commit d58b4fd
Showing
8 changed files
with
203 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
134 changes: 69 additions & 65 deletions
134
src/client/components/ui/Card/Link/LinkCard.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,81 +1,85 @@ | ||
@use "@styles/utilities-deprecated"; | ||
@use "@styles/utilities"; | ||
|
||
.card { | ||
position: relative; | ||
border-radius: 20px; | ||
box-shadow: 10px 10px 20px rgba(22, 22, 22, 0.05); | ||
background-color: utilities.$color-background-primary; | ||
padding: 1rem; | ||
max-height: calc(250px + 8.75rem); | ||
overflow: hidden; | ||
|
||
display: inline-block; | ||
width: 100%; | ||
&ImageWrapper { | ||
border-radius: 20px; | ||
min-height: 150px; | ||
max-height: 150px; | ||
flex: 0 1 200px; | ||
overflow: hidden; | ||
|
||
&Article { | ||
border-radius: 20px; | ||
box-shadow: 10px 10px 20px rgba(22, 22, 22, 0.05) !important; | ||
background-color: utilities-deprecated.$color-on-primary; | ||
position: relative; | ||
border-radius: 20px; | ||
display: flex; | ||
flex-direction: column; | ||
padding: 1rem; | ||
max-height: calc(250px + 8.75rem); | ||
overflow: hidden; | ||
img { | ||
height: 180px; | ||
width: 328px; | ||
} | ||
&ImageWrapper { | ||
position: relative; | ||
border-radius: 20px; | ||
min-height: 150px; | ||
max-height: 150px; | ||
flex: 0 1 200px; | ||
overflow: hidden; | ||
} | ||
|
||
img { | ||
height: 180px; | ||
width: 328px; | ||
} | ||
} | ||
&Content { | ||
min-height: 9rem; | ||
padding-top: 0.75rem; | ||
overflow: auto; | ||
&Header { | ||
margin-bottom: 0.25rem; | ||
display: flex; | ||
justify-content: space-between; | ||
} | ||
&Content { | ||
min-height: 9rem; | ||
padding-top: 0.75rem; | ||
overflow: auto; | ||
&Header { | ||
margin-bottom: 0.25rem; | ||
display: flex; | ||
justify-content: space-between; | ||
} | ||
} | ||
|
||
&Title { | ||
font-size: 1em; | ||
font-weight: bold; | ||
line-height: 1.2; | ||
margin-bottom: 0; | ||
} | ||
&Title { | ||
font-size: 1em; | ||
font-weight: bold; | ||
line-height: 1.2; | ||
margin-bottom: 0; | ||
} | ||
|
||
&Description > * { | ||
font-size: 1em; | ||
padding-right: 2rem; | ||
margin: 0; | ||
} | ||
&Description > * { | ||
font-size: 1em; | ||
padding-right: 2rem; | ||
margin: 0; | ||
} | ||
|
||
&Action { | ||
background-color: utilities.$color-primary; | ||
border-radius: 50%; | ||
padding: 0.25rem; | ||
color: utilities.$color-cta-texte-primary; | ||
width: 2rem; | ||
height: 2rem; | ||
|
||
&Action { | ||
background-color: utilities-deprecated.$color-primary; | ||
border-radius: 50%; | ||
padding: 0.25rem; | ||
color: utilities-deprecated.$color-on-primary; | ||
width: 2rem; | ||
height: 2rem; | ||
& > a { | ||
&::before { | ||
content: ''; | ||
position: absolute; | ||
left: 0; | ||
right: 0; | ||
top: 0; | ||
bottom: 0; | ||
background-color: rgba(0, 0, 0, 0); | ||
} | ||
} | ||
} | ||
} | ||
|
||
@include utilities-deprecated.media(medium) { | ||
.card { | ||
&ImageWrapper { | ||
min-height: 180px; | ||
max-height: 180px; | ||
} | ||
@include utilities.media(medium) { | ||
.card { | ||
&ImageWrapper { | ||
min-height: 180px; | ||
max-height: 180px; | ||
} | ||
|
||
&Content { | ||
padding-top: 1.25rem; | ||
} | ||
&Title { | ||
font-size: 1.25rem; | ||
} | ||
&Content { | ||
padding-top: 1.25rem; | ||
} | ||
&Title { | ||
font-size: 1.25rem; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* @jest-environment jsdom | ||
*/ | ||
|
||
import { | ||
render, | ||
screen, | ||
} from '@testing-library/react'; | ||
|
||
import { LinkCard } from '~/client/components/ui/Card/Link/LinkCard'; | ||
|
||
describe('LinkCard', () => { | ||
const defaultProps = { | ||
imageUrl: 'https://example.com/image.jpg', | ||
link: 'https://example.com', | ||
linkLabel: 'En savoir plus', | ||
title: 'Titre de test', | ||
}; | ||
|
||
it('affiche une carte lien avec tous les éléments', () => { | ||
render(<LinkCard {...defaultProps} />); | ||
|
||
expect(screen.getByRole('heading', { name: defaultProps.title })).toBeVisible(); | ||
expect(screen.getByRole('link')).toHaveAttribute('href', defaultProps.link); | ||
expect(screen.getByText(defaultProps.linkLabel)).toBeVisible(); | ||
expect(screen.getByText(defaultProps.linkLabel)).toHaveClass('sr-only'); | ||
expect(screen.getByRole('presentation')).toHaveAttribute('alt', ''); | ||
}); | ||
}); |
Oops, something went wrong.