Fix styling for GridReps and add new information
This commit is contained in:
parent
ea37cf6a79
commit
2a148db4c3
3 changed files with 117 additions and 60 deletions
|
|
@ -1,54 +1,82 @@
|
||||||
.GridRep {
|
.GridRep {
|
||||||
border: 2px solid transparent;
|
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: column;
|
||||||
flex-shrink: 0;
|
gap: $unit;
|
||||||
margin: 0 8px 8px 0;
|
padding: $unit * 2;
|
||||||
padding: 4px;
|
|
||||||
height: 148px;
|
|
||||||
width: 311px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.GridRep:hover {
|
&:hover {
|
||||||
border: 2px solid #2360C5;
|
background: white;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
|
||||||
|
|
||||||
.GridRep .weapon {
|
.Grid .grid_weapons .grid_weapon {
|
||||||
background: white;
|
box-shadow: inset 0 0 1px $grey-70;
|
||||||
border-radius: 4px;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.GridRep .grid_mainhand {
|
.Grid {
|
||||||
flex-shrink: 0;
|
display: flex;
|
||||||
height: 136px;
|
flex-direction: row;
|
||||||
width: 65px;
|
flex-shrink: 0;
|
||||||
margin-right: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.GridRep .grid_weapons {
|
.grid_mainhand {
|
||||||
list-style: none;
|
margin-right: $unit;
|
||||||
margin: 0;
|
height: 139px;
|
||||||
padding: 0;
|
width: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.GridRep .grid_weapon {
|
.grid_weapons {
|
||||||
background: white;
|
display: grid;
|
||||||
border-radius: 4px;
|
grid-template-columns: 1fr 1fr 1fr;
|
||||||
float: left;
|
grid-template-rows: 1fr 1fr 1fr;
|
||||||
margin: 0 8px 8px 0;
|
gap: $unit;
|
||||||
height: 40px;
|
margin: 0;
|
||||||
width: 70px;
|
padding: 0;
|
||||||
}
|
width: fit-content;
|
||||||
|
}
|
||||||
|
|
||||||
.GridRep .grid_weapon:nth-child(3n+3) {
|
.grid_weapon {
|
||||||
margin-right: 0;
|
background: white;
|
||||||
}
|
border-radius: 4px;
|
||||||
|
float: left;
|
||||||
|
height: 40px;
|
||||||
|
width: 70px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.grid_mainhand img[src*="jpg"],
|
||||||
|
.grid_weapon img[src*="jpg"] {
|
||||||
|
border-radius: 4px;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.GridRep .grid_mainhand img[src*="jpg"],
|
.Details {
|
||||||
.GridRep .grid_weapon img[src*="jpg"] {
|
display: flex;
|
||||||
border-radius: 4px;
|
flex-direction: column;
|
||||||
width: 100%;
|
gap: $unit / 2;
|
||||||
height: 100%;
|
|
||||||
}
|
h2 {
|
||||||
|
color: $grey-00;
|
||||||
|
font-size: $font-regular;
|
||||||
|
|
||||||
|
&.empty {
|
||||||
|
color: $grey-50;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottom {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
|
||||||
|
.raid, time {
|
||||||
|
color: $grey-50;
|
||||||
|
font-size: $font-small;
|
||||||
|
}
|
||||||
|
|
||||||
|
.raid {
|
||||||
|
flex-grow: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,37 @@
|
||||||
|
|
||||||
import React, { useEffect, useState } from 'react'
|
import React, { useEffect, useState } from 'react'
|
||||||
|
import classNames from 'classnames'
|
||||||
|
|
||||||
|
import { formatTimeAgo } from '~utils/timeAgo'
|
||||||
|
|
||||||
import './index.scss'
|
import './index.scss'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
shortcode: string
|
shortcode: string
|
||||||
|
name: string
|
||||||
|
raid: Raid
|
||||||
grid: GridWeapon[]
|
grid: GridWeapon[]
|
||||||
|
updatedAt: Date
|
||||||
onClick: (shortcode: string) => void
|
onClick: (shortcode: string) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
const GridRep = (props: Props) => {
|
const GridRep = (props: Props) => {
|
||||||
|
|
||||||
|
console.log(props)
|
||||||
const numWeapons: number = 9
|
const numWeapons: number = 9
|
||||||
|
|
||||||
const [mainhand, setMainhand] = useState<Weapon>()
|
const [mainhand, setMainhand] = useState<Weapon>()
|
||||||
const [weapons, setWeapons] = useState<GridArray<Weapon>>({})
|
const [weapons, setWeapons] = useState<GridArray<Weapon>>({})
|
||||||
|
|
||||||
|
const titleClass = classNames({
|
||||||
|
'empty': !props.name
|
||||||
|
})
|
||||||
|
|
||||||
|
const raidClass = classNames({
|
||||||
|
'raid': true,
|
||||||
|
'empty': !props.raid
|
||||||
|
})
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const newWeapons = Array(numWeapons)
|
const newWeapons = Array(numWeapons)
|
||||||
|
|
||||||
|
|
@ -43,21 +61,31 @@ const GridRep = (props: Props) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="GridRep" onClick={navigate}>
|
<div className="GridRep" onClick={navigate}>
|
||||||
<div className="weapon grid_mainhand">
|
<div className="Details">
|
||||||
{generateMainhandImage()}
|
<h2 className={titleClass}>{ (props.name) ? props.name : 'Untitled' }</h2>
|
||||||
|
<div className="bottom">
|
||||||
|
<div className={raidClass}>{ (props.raid) ? props.raid.name.en : 'No raid set' }</div>
|
||||||
|
<time className="last-updated" dateTime={props.updatedAt.toISOString()}>{formatTimeAgo(props.updatedAt, 'en-us')}</time>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul className="grid_weapons">
|
<div className="Grid">
|
||||||
{
|
<div className="weapon grid_mainhand">
|
||||||
Array.from(Array(numWeapons)).map((x, i) => {
|
{generateMainhandImage()}
|
||||||
return (
|
</div>
|
||||||
<li key={`${props.shortcode}-${i}`} className="grid_weapon">
|
|
||||||
{generateGridImage(i)}
|
<ul className="grid_weapons">
|
||||||
</li>
|
{
|
||||||
)
|
Array.from(Array(numWeapons)).map((x, i) => {
|
||||||
})
|
return (
|
||||||
}
|
<li key={`${props.shortcode}-${i}`} className="grid_weapon">
|
||||||
</ul>
|
{generateGridImage(i)}
|
||||||
|
</li>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
.GridRepCollection {
|
.GridRepCollection {
|
||||||
display: flex;
|
display: grid;
|
||||||
flex-wrap: wrap;
|
grid-template-columns: auto auto auto;
|
||||||
justify-content: center;
|
margin: 0 auto;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
width: fit-content;
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue