Skip to content

Commit

Permalink
Add ProgressBar and BackButton Components (#129)
Browse files Browse the repository at this point in the history
* Add ProgressBar Component

* Add changes to ProgressBar and BackButton

* Use colors from tailwind config for back button

* remove unnecessary stroke property on chevron

* Fix silly little mistake with class names
  • Loading branch information
tsar-boomba authored Sep 6, 2024
1 parent 43005d0 commit a8905c2
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
37 changes: 37 additions & 0 deletions web/components/atoms/BackButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { MouseEventHandler } from "react";

interface Props {
onClick?: MouseEventHandler<HTMLButtonElement>;
disabled?: boolean;
}

export default function BackButton({ onClick, disabled }: Props) {
return (
<button
className="group flex items-center gap-[2px] text-medium-gray"
onClick={onClick}
disabled={disabled}
>
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
>
<path
d="M15 18L9 12L15 6"
className={`stroke-medium-gray ${disabled ? "stroke-dark-gray" : "group-hover:stroke-dark-gray"}`}
strokeWidth="3"
strokeLinecap="square"
strokeLinejoin="round"
/>
</svg>
<div
className={`${disabled ? "text-dark-gray" : "group-hover:text-dark-gray"}`}
>
Back
</div>
</button>
);
}
15 changes: 15 additions & 0 deletions web/components/atoms/ProgressBar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
interface Props {
/** A number between 0 and 100 indicating the progress percentage */
progress: number;
}

export default function ProgressBar({ progress }: Props) {
return (
<div className="h-[6px] relative rounded-full bg-empty-gray">
<div
style={{ width: `${progress}%` }}
className="rounded-full bg-mbb-pink absolute top-0 left-0 bottom-0 transition-all"
/>
</div>
);
}
1 change: 1 addition & 0 deletions web/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ module.exports = {
"dark-gray": "#666666",
"icon-gray": "#BFBFBF",
"icon-light-gray": "#DFE3E8",
"empty-gray": "#E3E3E3",
dark: {
100: "#BFBFBF",
400: "#666666",
Expand Down

0 comments on commit a8905c2

Please sign in to comment.