-
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
263b871
commit 4905f5f
Showing
7 changed files
with
178 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
@use "@/styles/mixins"; | ||
|
||
$width: var(--width); | ||
$height: var(--height); | ||
|
||
.root { | ||
position: relative; | ||
width: $width; | ||
height: $height; | ||
border-radius: 12px; | ||
overflow: hidden; | ||
background-color: #0000001d; | ||
transition: all 200ms ease-in-out; | ||
|
||
@include mixins.dark { | ||
background-color: #ffffff0d; | ||
} | ||
|
||
img { | ||
width: 100%; | ||
height: 100%; | ||
object-fit: cover; | ||
} | ||
|
||
.loading { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
backdrop-filter: blur(5px); | ||
|
||
.loading-icon { | ||
position: absolute; | ||
top: 50%; | ||
left: 50%; | ||
transform: translate(-50%, -50%); | ||
} | ||
} | ||
} |
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,47 @@ | ||
import React, { ComponentProps, useState } from "react"; | ||
import styles from "./Image.module.scss"; | ||
import Loading from "@/components/icons/Loading"; | ||
|
||
export interface ImageProps extends ComponentProps<"img"> { | ||
src?: string; | ||
width?: string; | ||
height?: string; | ||
fallback?: React.ReactNode; | ||
} | ||
|
||
export function Image(props: ImageProps) { | ||
const { src, width = "fit-content", height = "100%", style } = props; | ||
|
||
const [err, setErr] = useState<boolean>(false); | ||
const [loading, setLoading] = useState<boolean>(true); | ||
|
||
const variables = { | ||
"--width": width, | ||
"--height": height, | ||
} as React.CSSProperties; | ||
|
||
return ( | ||
<div | ||
className={styles["root"]} | ||
style={{ | ||
...variables, | ||
...style, | ||
}} | ||
> | ||
<img | ||
src={src} | ||
alt={""} | ||
onLoad={() => setLoading(false)} | ||
onError={() => setErr(true)} | ||
draggable={false} | ||
/> | ||
{loading && ( | ||
<div className={styles["loading"]}> | ||
<div className={styles["loading-icon"]}> | ||
<Loading /> | ||
</div> | ||
</div> | ||
)} | ||
</div> | ||
); | ||
} |
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 { Image } from "./Image"; |
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,46 @@ | ||
@use "@/styles/mixins"; | ||
|
||
.main { | ||
position: fixed; | ||
top: 55%; | ||
left: 50%; | ||
transform: translate(-50%, -50%); | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
width: 100%; | ||
} | ||
|
||
.poster { | ||
position: relative; | ||
display: flex; | ||
justify-content: center; | ||
width: 100%; | ||
|
||
.info { | ||
position: absolute; | ||
width: 20%; | ||
height: 10vh; | ||
top: 0; | ||
left: 30%; | ||
transform: translate(-50%, -50%); | ||
border-radius: 12px; | ||
border: 2.75px solid var(--color-primary); | ||
box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1); | ||
background-color: var(--color-light); | ||
|
||
@include mixins.dark { | ||
background-color: var(--color-dark); | ||
} | ||
} | ||
|
||
.enter { | ||
position: absolute; | ||
width: 10%; | ||
height: 7vh; | ||
bottom: 0; | ||
right: 25%; | ||
transform: translate(50%, 50%); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,3 +1,37 @@ | ||
import { Image } from "@/components/core/Image"; | ||
import styles from "./page.module.scss"; | ||
import { Button } from "@/components/core"; | ||
import PlayCircleBold from "~icons/solar/play-circle-bold"; | ||
|
||
export function Page() { | ||
return <div>games</div>; | ||
return ( | ||
<> | ||
<h1>近期赛事</h1> | ||
<div className={styles["main"]}> | ||
<div className={styles["poster"]}> | ||
<Image | ||
src="https://picsum.photos/1920/1080" | ||
width="50%" | ||
height="60vh" | ||
style={{ | ||
boxShadow: "0 0 10px rgba(0, 0, 0, 0.5)", | ||
}} | ||
/> | ||
<div className={styles["info"]}> | ||
<span>CdsCTF 2024</span> | ||
</div> | ||
<div className={styles["enter"]}> | ||
<Button | ||
icon={<PlayCircleBold />} | ||
variant={"outlined"} | ||
width="100%" | ||
height="100%" | ||
> | ||
进入 | ||
</Button> | ||
</div> | ||
</div> | ||
</div> | ||
</> | ||
); | ||
} |