-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aaf7ce4
commit 7995bdc
Showing
8 changed files
with
107 additions
and
61 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
26 changes: 0 additions & 26 deletions
26
frontend/src/components/ExperimentCollection/Score/Score.tsx
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import useAnimatedScore from "@/hooks/useAnimatedScore"; | ||
|
||
interface ScoreCounterProps { | ||
score: number; | ||
label: string; | ||
} | ||
|
||
const ScoreCounter = ({ score, label }: ScoreCounterProps) => { | ||
const currentScore = useAnimatedScore(score); | ||
|
||
return ( | ||
<h3> | ||
{currentScore || currentScore === 0 ? currentScore + " " : ""} | ||
{label} | ||
</h3> | ||
); | ||
}; | ||
|
||
export default ScoreCounter; |
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,73 @@ | ||
import { BrowserRouter as Router } from "react-router-dom"; | ||
|
||
import Header from "../components/ExperimentCollection/Header/Header"; | ||
|
||
export default { | ||
title: "Header", | ||
component: Header, | ||
parameters: { | ||
layout: "fullscreen", | ||
}, | ||
}; | ||
|
||
function getHeaderData(overrides = {}) { | ||
return { | ||
description: "<h1>Experiment ABC</h1><p>This is the experiment description</p>", | ||
nextExperimentSlug: '/th1-mozart', | ||
nextExperimentButtonText: 'Volgende experiment', | ||
collectionSlug: '/collection/thkids', | ||
aboutButtonText: 'Over ons', | ||
totalScore: 420, | ||
scoreDisplayConfig: { | ||
scoreClass: 'gold', | ||
scoreLabel: 'points', | ||
}, | ||
...overrides, | ||
}; | ||
} | ||
|
||
const getDecorator = (Story) => ( | ||
<div | ||
className="aha__collection" | ||
style={{ width: "100%", height: "100%", backgroundColor: "#aaa", padding: "1rem" }} | ||
> | ||
<Router> | ||
<Story /> | ||
</Router> | ||
</div> | ||
); | ||
|
||
export const Default = { | ||
args: getHeaderData(), | ||
decorators: [getDecorator], | ||
}; | ||
|
||
export const ZeroScore = { | ||
args: getHeaderData({ score: 0, score_message: "No points!" }), | ||
decorators: [getDecorator], | ||
}; | ||
|
||
export const NegativeScore = { | ||
args: getHeaderData({ score: -100, score_message: "Incorrect!" }), | ||
decorators: [getDecorator], | ||
}; | ||
|
||
export const ScoreWithoutLabel = { | ||
args: getHeaderData({ score_message: "" }), | ||
decorators: [getDecorator], | ||
}; | ||
|
||
export const CustomLabel = { | ||
args: getHeaderData({ score_message: "points earned" }), | ||
decorators: [getDecorator], | ||
}; | ||
|
||
export const CustomScoreClass = { | ||
args: getHeaderData({ scoreClass: "silver" }), | ||
decorators: [getDecorator], | ||
}; | ||
|
||
export const SelectableScoreClass = { | ||
args: getHeaderData(), | ||
decorators: [getDecorator], | ||
}; |
6 changes: 3 additions & 3 deletions
6
frontend/src/stories/ScoreV1.stories.tsx → frontend/src/stories/Score.stories.tsx
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