mod tiles and nsfw blurring

This commit is contained in:
SpikeHD
2022-07-23 20:33:36 -07:00
parent d97e5c192f
commit 95267720a4
5 changed files with 105 additions and 25 deletions

View File

@@ -4,3 +4,16 @@
background-color: rgba(106, 105, 106, 0.6);
}
.ModListInner {
width: 100%;
height: 100%;
display: flex;
flex-direction: row;
flex-grow: 1;
align-items: center;
justify-content: center;
flex-wrap: wrap;
overflow-y: auto;
}

View File

@@ -1,15 +1,16 @@
import React from 'react'
import { getMods } from '../../../utils/gamebanana'
import { getMods, ModData } from '../../../utils/gamebanana'
import { LoadingCircle } from './LoadingCircle'
import './ModList.css'
import { ModTile } from './ModTile'
interface IProps {
mode: string
}
interface IState {
modList: string[]
modList: ModData[]
}
export class ModList extends React.Component<IProps, IState> {
@@ -22,13 +23,23 @@ export class ModList extends React.Component<IProps, IState> {
const mods = await getMods(this.props.mode)
console.log(mods)
this.setState({
modList: mods,
})
}
render() {
return (
<div className="ModList">
<LoadingCircle />
{this.state && this.state.modList ? (
<div className="ModListInner">
{this.state.modList.map((mod: ModData) => (
<ModTile mod={mod} key={mod.id} />
))}
</div>
) : (
<LoadingCircle />
)}
</div>
)
}

View File

@@ -0,0 +1,13 @@
.ModListItem {
width: 20%;
}
.ModListItem img {
object-fit: cover;
width: 80%;
height: 100px;
}
img.nsfw {
filter: blur(16px);
}

View File

@@ -1 +1,26 @@
export {}
import React from 'react'
import { ModData } from '../../../utils/gamebanana'
import './ModTile.css'
interface IProps {
mod: ModData
}
export class ModTile extends React.Component<IProps, never> {
constructor(props: IProps) {
super(props)
}
render() {
const { mod } = this.props
return (
<div className="ModListItem">
<span className="ModName">{mod.name}</span>
<img src={mod.images[0]} className={mod.nsfw ? 'nsfw' : ''} />
<div className="ModInner"></div>
</div>
)
}
}