-
Notifications
You must be signed in to change notification settings - Fork 21
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
3 changed files
with
81 additions
and
1 deletion.
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
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,42 @@ | ||
import React from "react"; | ||
import CategoriesMenuItem from "./CategoriesMenuItem"; | ||
import { ItemsMainCategoriesType } from "../data/items.type"; | ||
import Shield from "./Icons/Shield"; | ||
import Sword from "./Icons/Sword"; | ||
import Armor from "./Icons/Armor"; | ||
import { Dispatch, SetStateAction } from "react"; | ||
|
||
type Props = { | ||
categorySelected: ItemsMainCategoriesType; | ||
setPage: Dispatch<SetStateAction<number>>; | ||
}; | ||
|
||
const CategoriesMenu: React.FC<Props> = ({ categorySelected, setPage }) => { | ||
return ( | ||
<div className="flex mx-auto mb-6 z-20"> | ||
<CategoriesMenuItem | ||
page={0} | ||
setPage={setPage} | ||
isSelected={categorySelected === ItemsMainCategoriesType.WEAPONS} | ||
> | ||
<Sword className="fill-current h-10 w-16 pb-3 px-4" /> | ||
</CategoriesMenuItem> | ||
<CategoriesMenuItem | ||
page={1} | ||
setPage={setPage} | ||
isSelected={categorySelected === ItemsMainCategoriesType.SHIELDS} | ||
> | ||
<Shield className="fill-current h-10 w-16 pb-3 px-4" /> | ||
</CategoriesMenuItem> | ||
<CategoriesMenuItem | ||
page={2} | ||
setPage={setPage} | ||
isSelected={categorySelected === ItemsMainCategoriesType.ARMORS} | ||
> | ||
<Armor className="fill-current h-10 w-16 pb-3 px-4" /> | ||
</CategoriesMenuItem> | ||
</div> | ||
); | ||
}; | ||
|
||
export default CategoriesMenu; |
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,33 @@ | ||
import cx from "classnames"; | ||
import React from "react"; | ||
import { Dispatch, SetStateAction } from "react"; | ||
|
||
type Props = { | ||
page: number; | ||
setPage: Dispatch<SetStateAction<number>>; | ||
isSelected: boolean; | ||
}; | ||
|
||
const CategoriesMenuItem: React.FC<Props> = ({ | ||
page, | ||
setPage, | ||
isSelected, | ||
children, | ||
}) => ( | ||
<div | ||
onClick={() => { | ||
setPage(page); | ||
}} | ||
className={cx( | ||
{ | ||
"text-white border-white": isSelected, | ||
"text-zelda-lightGray border-zelda-lightGray": !isSelected, | ||
}, | ||
"border-b cursor-pointer" | ||
)} | ||
> | ||
{children} | ||
</div> | ||
); | ||
|
||
export default CategoriesMenuItem; |