-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 parent
1648d9b
commit 29fe105
Showing
59 changed files
with
339 additions
and
145 deletions.
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
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
File renamed without changes.
File renamed without changes.
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,3 @@ | ||
export function Index() { | ||
return <>1122</>; | ||
} |
File renamed without changes.
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,7 @@ | ||
.root { | ||
min-height: 100%; | ||
scroll-snap-align: center; | ||
flex: 1; | ||
|
||
padding: 3vh 10rem; | ||
} |
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,77 @@ | ||
import { Button, Flex, Pagination, Stack, TextInput } from "@/components/core"; | ||
import styles from "./All.module.scss"; | ||
import { useEffect, useState } from "react"; | ||
import MinimalisticMagniferBoldDuotone from "~icons/solar/minimalistic-magnifer-bold-duotone"; | ||
import { Game } from "@/models/game"; | ||
import { get } from "@/api/game"; | ||
import { GameCard } from "./GameCard"; | ||
|
||
export function All() { | ||
const [search, setSearch] = useState(""); | ||
const [searchInput, setSearchInput] = useState(""); | ||
const [games, setGames] = useState<Array<Game>>(); | ||
|
||
const [size, _] = useState(4); | ||
const [page, setPage] = useState(1); | ||
const [total, setTotal] = useState(0); | ||
|
||
function fetchGames() { | ||
get({ | ||
title: search, | ||
sorts: "-id", | ||
size: size, | ||
page: page, | ||
}).then((res) => { | ||
setGames(res.data); | ||
setTotal(res.total || 0); | ||
}); | ||
} | ||
|
||
useEffect(() => { | ||
fetchGames(); | ||
}, [search, page]); | ||
|
||
return ( | ||
<Stack | ||
className={styles["root"]} | ||
align={"center"} | ||
width={"100%"} | ||
gap={25} | ||
> | ||
<form | ||
onSubmit={(e) => { | ||
e.preventDefault(); | ||
setSearch(searchInput); | ||
}} | ||
style={{ | ||
width: "80%", | ||
}} | ||
> | ||
<Flex align={"center"} gap={15}> | ||
<TextInput | ||
icon={<MinimalisticMagniferBoldDuotone />} | ||
placeholder={"搜索"} | ||
value={searchInput} | ||
onChange={setSearchInput} | ||
clearable | ||
variant={"outlined"} | ||
style={{ | ||
flex: "1", | ||
}} | ||
/> | ||
<Button type={"submit"}>搜索</Button> | ||
</Flex> | ||
</form> | ||
<Stack width={"100%"} align={"center"} style={{ flex: 1 }} gap={15}> | ||
{games?.map((game) => <GameCard key={game.id} game={game} />)} | ||
</Stack> | ||
<Stack width={"100%"} align={"center"}> | ||
<Pagination | ||
total={Math.ceil(total / size)} | ||
value={page} | ||
onChange={setPage} | ||
/> | ||
</Stack> | ||
</Stack> | ||
); | ||
} |
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,38 @@ | ||
.root { | ||
position: relative; | ||
box-shadow: var(--shadow-md); | ||
background-color: var(--bg-2nd-color); | ||
min-height: calc(25% - 15px); | ||
max-height: calc(25% - 15px); | ||
width: 80%; | ||
|
||
border-radius: 20px; | ||
|
||
cursor: pointer; | ||
transition: all 0.2s ease-in-out; | ||
user-select: none; | ||
|
||
&:hover { | ||
filter: brightness(1.2); | ||
} | ||
|
||
&:active { | ||
box-shadow: none; | ||
transform: translateY(4px); | ||
} | ||
} | ||
|
||
.icon { | ||
position: absolute; | ||
left: -50%; | ||
} | ||
|
||
.trapezoid { | ||
position: absolute; | ||
right: -2px; | ||
top: -2px; | ||
width: 85px; | ||
height: 85px; | ||
background-color: var(--color-primary); | ||
clip-path: polygon(100% 100%, 100% 50%, 50% 0, 0% 0); | ||
} |
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,46 @@ | ||
import { Box, Flex, Image, Stack } from "@/components/core"; | ||
import styles from "./GameCard.module.scss"; | ||
import { Game } from "@/models/game"; | ||
|
||
export interface GameCardProps { | ||
game: Game; | ||
} | ||
|
||
export function GameCard(props: GameCardProps) { | ||
const { game } = props; | ||
|
||
return ( | ||
<Flex className={styles["root"]} gap={30} align={"flex-start"}> | ||
<Image | ||
src={`/api/games/${game?.id}/poster`} | ||
width={"25%"} | ||
radius={"20px 0 0 20px"} | ||
/> | ||
<Stack | ||
gap={10} | ||
width={"50%"} | ||
style={{ | ||
margin: "2rem 0", | ||
}} | ||
> | ||
<h2 | ||
style={{ | ||
fontSize: "1.25rem", | ||
fontWeight: 600, | ||
}} | ||
> | ||
{game?.title} | ||
</h2> | ||
<p | ||
style={{ | ||
fontSize: "0.875rem", | ||
fontWeight: 500, | ||
}} | ||
> | ||
{game?.sketch} | ||
</p> | ||
</Stack> | ||
<Box className={styles["trapezoid"]} /> | ||
</Flex> | ||
); | ||
} |
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 @@ | ||
export { GameCard } from "./GameCard"; |
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 @@ | ||
export { All } from "./All"; |
Oops, something went wrong.