This repository has been archived by the owner on Nov 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Merge pull request #19 from claustra01/shooter_kurk
add: ShooterButtonPage、galleryをyataiに変更
Showing
7 changed files
with
142 additions
and
1 deletion.
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
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
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,33 @@ | ||
.box { | ||
width: 250px; | ||
height: 250px; | ||
background: var(--black); | ||
border-radius: 50%; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
text-align: center; | ||
color: var(--white); | ||
font-weight: bold; | ||
font-size: 40px; | ||
border: none; | ||
cursor: pointer; | ||
position: relative; | ||
} | ||
|
||
.box img { | ||
position: absolute; | ||
bottom: 20px; | ||
width: 200px; | ||
height: 200px; | ||
opacity: 0.1; | ||
z-index: 1; | ||
} | ||
|
||
.box span { | ||
position: relative; | ||
z-index: 10; | ||
} | ||
|
||
|
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,37 @@ | ||
import type { KeyboardEventHandler, MouseEventHandler } from "react"; | ||
import styles from "./index.module.css"; | ||
|
||
interface ShooterButtonProps { | ||
onClick?: MouseEventHandler<HTMLDivElement>; | ||
onKeyUp?: KeyboardEventHandler<HTMLDivElement>; | ||
onKeyDown?: KeyboardEventHandler<HTMLDivElement>; | ||
onKeyPress?: KeyboardEventHandler<HTMLDivElement>; | ||
} | ||
|
||
export const ShooterButton = ({ | ||
onClick, | ||
onKeyUp, | ||
onKeyDown, | ||
onKeyPress, | ||
}: ShooterButtonProps) => { | ||
return ( | ||
<div | ||
className={styles.box} | ||
onClick={onClick} | ||
onKeyUp={onKeyUp} | ||
onKeyDown={onKeyDown} | ||
onKeyPress={onKeyPress} | ||
tabIndex={0} | ||
role="button" | ||
aria-label="Shoot" | ||
> | ||
<img | ||
src="/logo.webp" | ||
alt="ボタンの背景にロゴを表示させる" | ||
width="100" | ||
height="100" | ||
/> | ||
shoot | ||
</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,25 @@ | ||
.trigger{ | ||
position: absolute; | ||
top: 40%; | ||
left: 50%; | ||
transform: translate(-50%, -50%); | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
|
||
.cork { | ||
display: flex; | ||
justify-content: center; | ||
gap: 10px; | ||
position: absolute; | ||
top: 80%; | ||
left: 50%; | ||
transform: translate(-50%, -50%); | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
|
||
.cork img { | ||
width: 72px; | ||
height: 72px; | ||
} |
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,43 @@ | ||
import { type KeyboardEventHandler, useState } from "react"; | ||
import { ShooterButton } from "../../components/ui/ShooterButton"; | ||
import style from "./index.module.css"; | ||
|
||
function Shooter() { | ||
const initialImages = [ | ||
"/2D_material/cork.webp", | ||
"/2D_material/cork.webp", | ||
"/2D_material/cork.webp", | ||
]; | ||
|
||
const [images, setImages] = useState(initialImages); | ||
|
||
const handleClick = () => { | ||
setImages((prevImages) => prevImages.slice(1)); | ||
}; | ||
|
||
const handleKeyUp: KeyboardEventHandler<HTMLDivElement> = (event) => { | ||
if (event.key === "Enter" || event.key === " ") { | ||
handleClick(); | ||
} | ||
}; | ||
|
||
return ( | ||
<div> | ||
<div className={style.trigger}> | ||
<ShooterButton | ||
onClick={handleClick} | ||
onKeyUp={handleKeyUp} | ||
onKeyDown={handleKeyUp} | ||
onKeyPress={handleKeyUp} | ||
/> | ||
</div> | ||
<div className={style.cork}> | ||
{images.map((src) => ( | ||
<img key={src} src={src} alt="コルクの残量を表示しています" /> | ||
))} | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
export default Shooter; |