Skip to content

Commit

Permalink
feat(mon-pix): add counter in outro flashcard
Browse files Browse the repository at this point in the history
Co-authored-by: Clément Latzarus <[email protected]>
Co-authored-by: dianeCdrPix <[email protected]>
Co-authored-by: Yann Bertrand <[email protected]>
  • Loading branch information
4 people committed Oct 24, 2024
1 parent d125fb2 commit 897de0f
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PixButton from '@1024pix/pix-ui/components/pix-button';
import PixMessage from '@1024pix/pix-ui/components/pix-message';
import { t } from 'ember-intl';
import {t} from 'ember-intl';

<template>
<div class="element-flashcards-outro-card">
Expand All @@ -10,8 +10,14 @@ import { t } from 'ember-intl';
<p class="element-flashcards-outro-card__title">{{@title}}</p>
</div>

<div class="element-flashcards-outro-card__text">

<div>
<p class="element-flashcards-outro-card__question">{{t "pages.modulix.flashcards.answerDirection"}}</p>
<ul class="element-flashcards-outro-card__counter">
<li class="element-flashcards-outro-card__counter__yes"> {{t "pages.modulix.flashcards.counter.yes"
totalYes=@counter.yes}} </li>
<li class="element-flashcards-outro-card__counter__almost"> {{t "pages.modulix.flashcards.counter.almost" totalAlmost=@counter.almost}} </li>
<li class="element-flashcards-outro-card__counter__no"> {{t "pages.modulix.flashcards.counter.no" totalNo=@counter.no}} </li>
</ul>
</div>

<div class="element-flashcards-outro-card__footer">
Expand Down
26 changes: 24 additions & 2 deletions mon-pix/app/styles/components/module/_flashcards-card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@
}

.element-flashcards-intro-card,
.element-flashcards-outro-card
{
.element-flashcards-outro-card {
align-items: center;
padding: var(--pix-spacing-2x);
padding-bottom: var(--pix-spacing-6x);
Expand Down Expand Up @@ -106,5 +105,28 @@
padding: 0 16px;
color: var(--pix-neutral-0);
}

&__question {
@extend %pix-body-s;
font-weight: 700;
margin-bottom: var(--pix-spacing-2x);
}

&__counter {
@extend %pix-body-l;
font-weight: 700;

&__yes {
color: var(--pix-success-500);
}

&__almost {
color: var(--pix-warning-500);
}

&__no {
color: var(--pix-error-500);
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,21 @@ module('Integration | Component | Module | Flashcards Outro Card', function (hoo

test('should display an outro card', async function (assert) {
// given
const counter = { yes: 1, almost: 2, no: 1 };
const title = 'Introduction à la poésie';

// when
const screen = await render(<template>
<ModulixFlashcardsOutroCard @title={{title}} /></template>);

const screen = await render(
<template><ModulixFlashcardsOutroCard @counter={{counter}} @title={{title}} /></template>,
);

await this.pauseTest();
// then
// TODO Remove this pause test
// await this.pauseTest();
assert.ok(screen.getByText('Introduction à la poésie'));
assert.ok(screen.getByText(`Oui ! : ${counter.yes}`));
assert.ok(screen.getByText(`Presque : ${counter.almost}`));
assert.ok(screen.getByText(`Pas du tout : ${counter.no}`));
assert.dom(screen.getByRole('button', { name: t('pages.modulix.buttons.flashcards.retry') })).exists();
});

Expand All @@ -31,11 +36,7 @@ module('Integration | Component | Module | Flashcards Outro Card', function (hoo
const title = 'Introduction à la poésie';
const onRetryStub = sinon.stub();

await render(
<template>
<ModulixFlashcardsOutroCard @title={{title}} @onRetry={{onRetryStub}} />
</template>,
);
await render(<template><ModulixFlashcardsOutroCard @title={{title}} @onRetry={{onRetryStub}} /></template>);

// when
await clickByName(t('pages.modulix.buttons.flashcards.retry'));
Expand Down
5 changes: 5 additions & 0 deletions mon-pix/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -1510,6 +1510,11 @@
},
"flashcards": {
"answerDirection": "Vous aviez la réponse ?",
"counter": {
"almost": "Presque : {totalAlmost}",
"no": "Pas du tout : {totalNo}",
"yes": "Oui ! : {totalYes}"
},
"direction": "Cherchez la réponse puis tournez la carte",
"position": "Carte {currentCardPosition}/{totalCards}"
},
Expand Down

0 comments on commit 897de0f

Please sign in to comment.