-
Notifications
You must be signed in to change notification settings - Fork 20
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
Showing
16 changed files
with
592 additions
and
822 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,32 @@ | ||
import Image from 'next/image'; | ||
|
||
interface ProgressBarProps { | ||
ducksFilled: number; | ||
} | ||
|
||
function ProgressBar({ ducksFilled }: ProgressBarProps) { | ||
const renderDucks = () => { | ||
const ducks = []; | ||
for (let i = 1; i <= 4; i++) { | ||
const duckColor = i <= ducksFilled ? 'yellowDuck.svg' : 'greyDuckOutline.svg'; | ||
ducks.push( | ||
<div key={i} className="flex items-center justify-center"> | ||
<Image | ||
src={`/images/${duckColor}`} | ||
alt={i <= ducksFilled ? 'Yellow Duck' : 'Grey Duck Outline'} | ||
className="h-10 md:h-12 scale-x-[-1]" | ||
height={100} | ||
width={100} | ||
/> | ||
<div className="absolute mt-20 text-bla ck font-bold">{i}</div> | ||
</div> | ||
); | ||
} | ||
return ducks; | ||
}; | ||
function Duck({ filled, index }: { filled?: boolean; index: number }) { | ||
const duckImageName = filled ? 'yellowDuck.svg' : 'greyDuckOutline.svg'; | ||
const duckImageAlt = filled ? 'Yellow Duck' : 'Grey Duck Outline'; | ||
|
||
return <div className="flex items-end justify-center mt-4 mb-12">{renderDucks()}</div>; | ||
return ( | ||
<div className="flex items-center justify-center"> | ||
<Image | ||
src={`/images/${duckImageName}`} | ||
alt={duckImageAlt} | ||
className="h-10 md:h-12 scale-x-[-1]" | ||
height={100} | ||
width={100} | ||
/> | ||
<div className="absolute mt-20 text-black font-bold">{index}</div> | ||
</div> | ||
); | ||
} | ||
|
||
export default ProgressBar; | ||
export default function ProgressBar({ step }: { step: number }) { | ||
return ( | ||
<div className="flex items-end justify-center mt-4 mb-12"> | ||
{new Array(step).fill(null).map((_, i) => ( | ||
<Duck filled index={i + 1} key={i} /> | ||
))} | ||
{new Array(4 - step).fill(null).map((_, i) => ( | ||
<Duck index={step + i + 1} key={i} /> | ||
))} | ||
</div> | ||
); | ||
} |
Oops, something went wrong.