?kawaii
This commit is contained in:
parent
93ff8356ce
commit
57ce45f396
2 changed files with 34 additions and 17 deletions
|
|
@ -14,3 +14,7 @@
|
||||||
z-index: 9;
|
z-index: 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.profile {
|
||||||
|
width: 256px;
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
@ -1,14 +1,25 @@
|
||||||
import { useEffect, useState, useMemo } from 'react';
|
import { useEffect, useState, useMemo } from 'react';
|
||||||
|
import { useLocation } from 'react-router-dom';
|
||||||
import './Root.css';
|
import './Root.css';
|
||||||
import Help from '../component/help';
|
import Help from '../component/help';
|
||||||
|
|
||||||
function Root() {
|
function Root() {
|
||||||
|
const location = useLocation();
|
||||||
const name: string[] = useMemo(() => ['imnyang', '아임냥', '암냥', '임냥', '@not.furry_', '@imnyang', '@mahiro_me'], []);
|
const name: string[] = useMemo(() => ['imnyang', '아임냥', '암냥', '임냥', '@not.furry_', '@imnyang', '@mahiro_me'], []);
|
||||||
const [nameIndex, setNameIndex] = useState(0);
|
const [nameIndex, setNameIndex] = useState(0);
|
||||||
|
const [imageSrc, setImageSrc] = useState('https://f.imnyang.xyz/profile/imnyang.webp');
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const queryParams = new URLSearchParams(location.search);
|
||||||
|
if (queryParams.has('kawaii')) {
|
||||||
|
setImageSrc('https://f.imnyang.xyz/profile/magic_imnyang.webp');
|
||||||
|
} else {
|
||||||
|
setImageSrc('https://f.imnyang.xyz/profile/imnyang.webp');
|
||||||
|
}
|
||||||
|
}, [location.search]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const handleKeyDown = (event: KeyboardEvent) => {
|
const handleKeyDown = (event: KeyboardEvent) => {
|
||||||
// 단일 키 입력 감지
|
|
||||||
console.log(`Key: ${event.key} with keycode ${event.keyCode} has been pressed`);
|
console.log(`Key: ${event.key} with keycode ${event.keyCode} has been pressed`);
|
||||||
if (event.key === 'l') {
|
if (event.key === 'l') {
|
||||||
console.log('Change My Name');
|
console.log('Change My Name');
|
||||||
|
|
@ -22,8 +33,10 @@ function Root() {
|
||||||
document.removeEventListener('keydown', handleKeyDown);
|
document.removeEventListener('keydown', handleKeyDown);
|
||||||
};
|
};
|
||||||
}, [name.length, name]);
|
}, [name.length, name]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='App'>
|
<div className='App'>
|
||||||
|
<img src={imageSrc} width={256} className='profile' />
|
||||||
<h1 style={{color: '#fadfee', fontSize: 60, margin: 0}}>
|
<h1 style={{color: '#fadfee', fontSize: 60, margin: 0}}>
|
||||||
{name[nameIndex]}
|
{name[nameIndex]}
|
||||||
</h1>
|
</h1>
|
||||||
|
|
@ -43,7 +56,7 @@ function Root() {
|
||||||
</div>
|
</div>
|
||||||
<Help />
|
<Help />
|
||||||
</div>
|
</div>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Root;
|
export default Root;
|
||||||
Loading…
Add table
Add a link
Reference in a new issue