Skip to content

Commit

Permalink
feat(client): implement 'change dice' functionality #70 #89
Browse files Browse the repository at this point in the history
  • Loading branch information
anonfedora committed Oct 4, 2024
1 parent 33cc8c0 commit 8791798
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 5 additions & 3 deletions client/src/components/DiceCard.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// import "../styles/OptionCard.scss";
import "../styles/OptionCard.scss";

interface Option {
name: string;
}
export default function DiceCard({
img,
active,
Expand All @@ -10,15 +12,15 @@ export default function DiceCard({
img?: string;
active?: boolean;
onSelect?: () => void;
option?: any;
option?: Option;
}) {
return (
<button
className={`option-container ${active ? "active" : ""}`}
onClick={onSelect}
>
<div className="option">
<div className="name-label">{option.name}</div>
<div className="name-label">{option?.name}</div>
<img src={img} alt="board" />
<div className="option-label">5/6</div>
</div>
Expand Down
4 changes: 3 additions & 1 deletion client/src/context/dice-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,7 @@ interface DiceContextType {

export const DiceContext = createContext<DiceContextType>({
dice: "",
changeDice: () => {},
changeDice: () => {
throw new Error("changeDice function must be overridden");
},
});

0 comments on commit 8791798

Please sign in to comment.