mirror of
https://github.com/mosh-hamedani/game-hub.git
synced 2026-05-21 12:14:32 +02:00
Build sort selector
This commit is contained in:
parent
08cbda491b
commit
d62ca49e21
|
|
@ -1,9 +1,10 @@
|
||||||
import { Grid, GridItem, Show } from "@chakra-ui/react";
|
import { Grid, GridItem, HStack, Show } from "@chakra-ui/react";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import GameGrid from "./components/GameGrid";
|
import GameGrid from "./components/GameGrid";
|
||||||
import GenreList from "./components/GenreList";
|
import GenreList from "./components/GenreList";
|
||||||
import NavBar from "./components/NavBar";
|
import NavBar from "./components/NavBar";
|
||||||
import PlatformSelector from "./components/PlatformSelector";
|
import PlatformSelector from "./components/PlatformSelector";
|
||||||
|
import SortSelector from "./components/SortSelector";
|
||||||
import { Platform } from "./hooks/useGames";
|
import { Platform } from "./hooks/useGames";
|
||||||
import { Genre } from "./hooks/useGenres";
|
import { Genre } from "./hooks/useGenres";
|
||||||
|
|
||||||
|
|
@ -36,7 +37,10 @@ function App() {
|
||||||
</GridItem>
|
</GridItem>
|
||||||
</Show>
|
</Show>
|
||||||
<GridItem area="main">
|
<GridItem area="main">
|
||||||
<PlatformSelector selectedPlatform={gameQuery.platform} onSelectPlatform={(platform) => setGameQuery({ ...gameQuery, platform}) } />
|
<HStack spacing={5} paddingLeft={2} marginBottom={5}>
|
||||||
|
<PlatformSelector selectedPlatform={gameQuery.platform} onSelectPlatform={(platform) => setGameQuery({ ...gameQuery, platform}) } />
|
||||||
|
<SortSelector />
|
||||||
|
</HStack>
|
||||||
<GameGrid gameQuery={gameQuery} />
|
<GameGrid gameQuery={gameQuery} />
|
||||||
</GridItem>
|
</GridItem>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
|
||||||
22
src/components/SortSelector.tsx
Normal file
22
src/components/SortSelector.tsx
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
import { Button, Menu, MenuButton, MenuItem, MenuList } from '@chakra-ui/react';
|
||||||
|
import { BsChevronDown } from 'react-icons/bs';
|
||||||
|
|
||||||
|
const SortSelector = () => {
|
||||||
|
return (
|
||||||
|
<Menu>
|
||||||
|
<MenuButton as={Button} rightIcon={<BsChevronDown />}>
|
||||||
|
Order by: Relevance
|
||||||
|
</MenuButton>
|
||||||
|
<MenuList>
|
||||||
|
<MenuItem>Relevance</MenuItem>
|
||||||
|
<MenuItem>Date added</MenuItem>
|
||||||
|
<MenuItem>Name</MenuItem>
|
||||||
|
<MenuItem>Release date</MenuItem>
|
||||||
|
<MenuItem>Popularity</MenuItem>
|
||||||
|
<MenuItem>Average rating</MenuItem>
|
||||||
|
</MenuList>
|
||||||
|
</Menu>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default SortSelector
|
||||||
Loading…
Reference in a new issue