better styling, download overlay on hover

This commit is contained in:
SpikeHD
2022-07-23 23:03:18 -07:00
parent 8700a77ba0
commit c0740417e3
2 changed files with 58 additions and 7 deletions

View File

@@ -3,7 +3,7 @@
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
width: 20%; width: 23%;
margin: 10px; margin: 10px;
background: rgb(99, 98, 98, 0.2); background: rgb(99, 98, 98, 0.2);
@@ -18,6 +18,7 @@
background: rgb(99, 98, 98, 0.8); background: rgb(99, 98, 98, 0.8);
} }
.ModAuthor,
.ModName { .ModName {
width: 100%; width: 100%;
text-overflow: ellipsis; text-overflow: ellipsis;
@@ -30,14 +31,47 @@
font-weight: bold; font-weight: bold;
} }
.ModListItem img { .ModAuthor {
font-weight: normal;
padding: 0 0 0 10px;
}
.ModTileDownload {
position: absolute;
object-fit: contain;
left: 35%;
top: 40%;
z-index: 999;
width: 40px !important;
height: 40px !important;
filter: invert(1);
}
.ModImage {
width: 100%;
height: 100%;
object-fit: cover; object-fit: cover;
width: 80%; display: flex;
height: 100px; align-items: center;
justify-content: center;
}
.ModImage img {
object-fit: cover;
width: 100%;
height: 150px;
margin: 14px; margin: 14px;
} }
img.blur {
filter: blur(6px);
}
img.nsfw { img.nsfw {
filter: blur(16px); filter: blur(16px);
} }

View File

@@ -4,23 +4,40 @@ import { ModData } from '../../../utils/gamebanana'
import './ModTile.css' import './ModTile.css'
import Like from '../../../resources/icons/like.svg' import Like from '../../../resources/icons/like.svg'
import Eye from '../../../resources/icons/eye.svg' import Eye from '../../../resources/icons/eye.svg'
import Download from '../../../resources/icons/download.svg'
interface IProps { interface IProps {
mod: ModData mod: ModData
} }
export class ModTile extends React.Component<IProps, never> { interface IState {
hover: boolean
}
export class ModTile extends React.Component<IProps, IState> {
constructor(props: IProps) { constructor(props: IProps) {
super(props) super(props)
this.state = {
hover: false,
}
} }
render() { render() {
const { mod } = this.props const { mod } = this.props
return ( return (
<div className="ModListItem"> <div
className="ModListItem"
onMouseEnter={() => this.setState({ hover: true })}
onMouseLeave={() => this.setState({ hover: false })}
>
<span className="ModName">{mod.name}</span> <span className="ModName">{mod.name}</span>
<img src={mod.images[0]} className={mod.nsfw ? 'nsfw' : ''} /> <span className="ModAuthor">{mod.submitter.name}</span>
<div className="ModImage">
{this.state.hover && <img src={Download} className="ModTileDownload" alt="Download" />}
<img src={mod.images[0]} className={`${mod.nsfw ? 'nsfw' : ''} ${this.state.hover ? 'blur' : ''}`} />
</div>
<div className="ModInner"> <div className="ModInner">
<div className="likes"> <div className="likes">
<img src={Like} /> <img src={Like} />