Move GridRep/Collection and add fade in
This commit is contained in:
parent
6dd2579e6e
commit
10cb78c11f
4 changed files with 25 additions and 1 deletions
|
|
@ -9,6 +9,16 @@
|
||||||
padding: $unit-2x;
|
padding: $unit-2x;
|
||||||
min-width: 320px;
|
min-width: 320px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
opacity: 1;
|
||||||
|
transition: opacity 0.3s ease-in-out;
|
||||||
|
|
||||||
|
&.visible {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.hidden {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background: var(--grid-rep-hover);
|
background: var(--grid-rep-hover);
|
||||||
|
|
@ -40,10 +40,16 @@ const GridRep = (props: Props) => {
|
||||||
const locale =
|
const locale =
|
||||||
router.locale && ['en', 'ja'].includes(router.locale) ? router.locale : 'en'
|
router.locale && ['en', 'ja'].includes(router.locale) ? router.locale : 'en'
|
||||||
|
|
||||||
|
const [visible, setVisible] = useState(false)
|
||||||
const [mainhand, setMainhand] = useState<Weapon>()
|
const [mainhand, setMainhand] = useState<Weapon>()
|
||||||
const [weapons, setWeapons] = useState<GridArray<Weapon>>({})
|
const [weapons, setWeapons] = useState<GridArray<Weapon>>({})
|
||||||
const [grid, setGrid] = useState<GridArray<GridWeapon>>({})
|
const [grid, setGrid] = useState<GridArray<GridWeapon>>({})
|
||||||
|
|
||||||
|
const gridRepStyles = classNames({
|
||||||
|
[styles.gridRep]: true,
|
||||||
|
[styles.visible]: visible,
|
||||||
|
[styles.hidden]: !visible,
|
||||||
|
})
|
||||||
const titleClass = classNames({
|
const titleClass = classNames({
|
||||||
empty: !props.name,
|
empty: !props.name,
|
||||||
})
|
})
|
||||||
|
|
@ -68,6 +74,14 @@ const GridRep = (props: Props) => {
|
||||||
[styles.grid]: true,
|
[styles.grid]: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setVisible(false) // Trigger fade out
|
||||||
|
const timeout = setTimeout(() => {
|
||||||
|
setVisible(true) // Trigger fade in
|
||||||
|
}, 300) // You can adjust the timing based on your preference
|
||||||
|
return () => clearTimeout(timeout)
|
||||||
|
}, [])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const newWeapons = Array(numWeapons)
|
const newWeapons = Array(numWeapons)
|
||||||
const gridWeapons = Array(numWeapons)
|
const gridWeapons = Array(numWeapons)
|
||||||
|
|
@ -249,7 +263,7 @@ const GridRep = (props: Props) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Link legacyBehavior href={`/p/${props.shortcode}`}>
|
<Link legacyBehavior href={`/p/${props.shortcode}`}>
|
||||||
<a className={styles.gridRep}>
|
<a className={gridRepStyles}>
|
||||||
{detailsWithUsername}
|
{detailsWithUsername}
|
||||||
<div className={styles.weaponGrid}>
|
<div className={styles.weaponGrid}>
|
||||||
<div className={mainhandClasses}>{generateMainhandImage()}</div>
|
<div className={mainhandClasses}>{generateMainhandImage()}</div>
|
||||||
Loading…
Reference in a new issue