Skip to content

Commit

Permalink
add heading
Browse files Browse the repository at this point in the history
  • Loading branch information
HoussamMrabet committed Jun 18, 2023
1 parent b4e0375 commit 7ff766a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Genre } from "./hooks/useGenres";
import PlatformSelector from "./components/PlatformSelector";
import { Platform } from "./hooks/usePlatforms";
import SortSelector from "./components/SortSelector";
import GameHeading from "./components/GameHeading";

export interface GameQuery {
genre: Genre | null;
Expand Down Expand Up @@ -41,6 +42,7 @@ function App() {
</GridItem>
</Show>
<GridItem area="main" paddingX="10px">
<GameHeading gameQuery={gameQuery} />
<HStack>
<PlatformSelector
onSelectPlatform={(platform) => setGameQuery({...gameQuery, platform})}
Expand Down
15 changes: 15 additions & 0 deletions src/components/GameHeading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
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" fontSize="5xl">{heading}</Heading>
)
}

export default GameHeading

0 comments on commit 7ff766a

Please sign in to comment.