From 2a148db4c3617fe24a9267c79768f262f5790026 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Sat, 26 Feb 2022 17:46:32 -0800 Subject: [PATCH] Fix styling for GridReps and add new information --- components/GridRep/index.scss | 116 +++++++++++++++--------- components/GridRep/index.tsx | 54 ++++++++--- components/GridRepCollection/index.scss | 7 +- 3 files changed, 117 insertions(+), 60 deletions(-) diff --git a/components/GridRep/index.scss b/components/GridRep/index.scss index 029774f0..01d9d4f8 100644 --- a/components/GridRep/index.scss +++ b/components/GridRep/index.scss @@ -1,54 +1,82 @@ .GridRep { - border: 2px solid transparent; border-radius: 6px; display: flex; - flex-direction: row; - flex-shrink: 0; - margin: 0 8px 8px 0; - padding: 4px; - height: 148px; - width: 311px; -} + flex-direction: column; + gap: $unit; + padding: $unit * 2; -.GridRep:hover { - border: 2px solid #2360C5; - cursor: pointer; -} + &:hover { + background: white; + cursor: pointer; -.GridRep .weapon { - background: white; - border-radius: 4px; -} + .Grid .grid_weapons .grid_weapon { + box-shadow: inset 0 0 1px $grey-70; + } + } -.GridRep .grid_mainhand { - flex-shrink: 0; - height: 136px; - width: 65px; - margin-right: 8px; -} + .Grid { + display: flex; + flex-direction: row; + flex-shrink: 0; -.GridRep .grid_weapons { - list-style: none; - margin: 0; - padding: 0; -} + .grid_mainhand { + margin-right: $unit; + height: 139px; + width: auto; + } -.GridRep .grid_weapon { - background: white; - border-radius: 4px; - float: left; - margin: 0 8px 8px 0; - height: 40px; - width: 70px; -} + .grid_weapons { + display: grid; + grid-template-columns: 1fr 1fr 1fr; + grid-template-rows: 1fr 1fr 1fr; + gap: $unit; + margin: 0; + padding: 0; + width: fit-content; + } -.GridRep .grid_weapon:nth-child(3n+3) { - margin-right: 0; -} + .grid_weapon { + 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"], -.GridRep .grid_weapon img[src*="jpg"] { - border-radius: 4px; - width: 100%; - height: 100%; -} \ No newline at end of file + .Details { + display: flex; + flex-direction: column; + gap: $unit / 2; + + 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; + } + } +} diff --git a/components/GridRep/index.tsx b/components/GridRep/index.tsx index 74a86f52..14b0b785 100644 --- a/components/GridRep/index.tsx +++ b/components/GridRep/index.tsx @@ -1,19 +1,37 @@ + import React, { useEffect, useState } from 'react' +import classNames from 'classnames' + +import { formatTimeAgo } from '~utils/timeAgo' import './index.scss' interface Props { shortcode: string + name: string + raid: Raid grid: GridWeapon[] + updatedAt: Date onClick: (shortcode: string) => void } const GridRep = (props: Props) => { + + console.log(props) const numWeapons: number = 9 const [mainhand, setMainhand] = useState() const [weapons, setWeapons] = useState>({}) + const titleClass = classNames({ + 'empty': !props.name + }) + + const raidClass = classNames({ + 'raid': true, + 'empty': !props.raid + }) + useEffect(() => { const newWeapons = Array(numWeapons) @@ -43,21 +61,31 @@ const GridRep = (props: Props) => { return (
-
- {generateMainhandImage()} +
+

{ (props.name) ? props.name : 'Untitled' }

+
+
{ (props.raid) ? props.raid.name.en : 'No raid set' }
+ +
-
    - { - Array.from(Array(numWeapons)).map((x, i) => { - return ( -
  • - {generateGridImage(i)} -
  • - ) - }) - } -
+
+
+ {generateMainhandImage()} +
+ +
    + { + Array.from(Array(numWeapons)).map((x, i) => { + return ( +
  • + {generateGridImage(i)} +
  • + ) + }) + } +
+
) } diff --git a/components/GridRepCollection/index.scss b/components/GridRepCollection/index.scss index a1c7150f..d5193311 100644 --- a/components/GridRepCollection/index.scss +++ b/components/GridRepCollection/index.scss @@ -1,6 +1,7 @@ .GridRepCollection { - display: flex; - flex-wrap: wrap; - justify-content: center; + display: grid; + grid-template-columns: auto auto auto; + margin: 0 auto; padding: 0; + width: fit-content; } \ No newline at end of file