mirror of
https://github.com/mosh-hamedani/game-hub.git
synced 2026-05-21 12:14:32 +02:00
Add a dynamic page heading
This commit is contained in:
parent
f002e86214
commit
c5dc8367f6
|
|
@ -1,6 +1,7 @@
|
|||
import { Box, Flex, Grid, GridItem, HStack, Show } from "@chakra-ui/react";
|
||||
import { useState } from "react";
|
||||
import GameGrid from "./components/GameGrid";
|
||||
import GameHeading from "./components/GameHeading";
|
||||
import GenreList from "./components/GenreList";
|
||||
import NavBar from "./components/NavBar";
|
||||
import PlatformSelector from "./components/PlatformSelector";
|
||||
|
|
@ -39,12 +40,15 @@ function App() {
|
|||
</GridItem>
|
||||
</Show>
|
||||
<GridItem area="main">
|
||||
<Flex paddingLeft={2} marginBottom={5}>
|
||||
<Box paddingLeft={2}>
|
||||
<GameHeading gameQuery={gameQuery} />
|
||||
<Flex marginBottom={5}>
|
||||
<Box marginRight={5}>
|
||||
<PlatformSelector selectedPlatform={gameQuery.platform} onSelectPlatform={(platform) => setGameQuery({ ...gameQuery, platform}) } />
|
||||
</Box>
|
||||
<SortSelector sortOrder={gameQuery.sortOrder} onSelectSortOrder={(sortOrder) => setGameQuery({ ...gameQuery, sortOrder })} />
|
||||
</Flex>
|
||||
</Box>
|
||||
<GameGrid gameQuery={gameQuery} />
|
||||
</GridItem>
|
||||
</Grid>
|
||||
|
|
|
|||
16
src/components/GameHeading.tsx
Normal file
16
src/components/GameHeading.tsx
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import { Heading } from '@chakra-ui/react'
|
||||
import { GameQuery } from '../App'
|
||||
|
||||
interface Props {
|
||||
gameQuery: GameQuery
|
||||
}
|
||||
|
||||
const GameHeading = ({ gameQuery }: Props) => {
|
||||
const heading = `${gameQuery.platform?.name || ''} ${gameQuery.genre?.name || ''} Games`;
|
||||
|
||||
return (
|
||||
<Heading as='h1' marginY={5} fontSize='5xl'>{heading}</Heading>
|
||||
)
|
||||
}
|
||||
|
||||
export default GameHeading
|
||||
Loading…
Reference in a new issue