Update GridRep

This commit is contained in:
Justin Edmund 2023-06-30 14:02:53 -07:00
parent 58d1320484
commit ee9b95bace
2 changed files with 47 additions and 32 deletions

View file

@ -1,5 +1,6 @@
.gridRep { .gridRep {
aspect-ratio: 3/2; aspect-ratio: 3/2;
border: 1px solid transparent;
border-radius: $card-corner; border-radius: $card-corner;
box-sizing: border-box; box-sizing: border-box;
display: grid; display: grid;
@ -11,6 +12,7 @@
&:hover { &:hover {
background: var(--grid-rep-hover); background: var(--grid-rep-hover);
border: 1px solid rgba(0, 0, 0, 0.1);
a { a {
text-decoration: none; text-decoration: none;
@ -82,11 +84,12 @@
.details { .details {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: calc($unit / 2); gap: $unit;
h2 { h2 {
color: var(--text-primary); color: var(--text-primary);
font-size: $font-regular; font-size: $font-regular;
font-weight: $bold;
overflow: hidden; overflow: hidden;
padding-bottom: 1px; padding-bottom: 1px;
text-overflow: ellipsis; text-overflow: ellipsis;
@ -117,16 +120,21 @@
} }
} }
.attributed,
.bottom { .bottom {
display: flex; display: flex;
flex-direction: row; gap: $unit-half;
justify-content: space-between;
a.user:hover { a.user:hover {
color: var(--link-text-hover); color: var(--link-text-hover);
} }
} }
.properties, .bottom {
flex-direction: column;
}
.user { .user {
flex-grow: 1; flex-grow: 1;
} }
@ -134,23 +142,44 @@
.user, .user,
.raid, .raid,
time { time {
color: $grey-55; color: var(--text-tertiary);
font-size: $font-small; font-size: $font-small;
} }
time {
white-space: nowrap;
}
.properties { .properties {
display: flex;
font-size: $font-small;
gap: $unit-half;
.raid {
white-space: nowrap;
text-overflow: ellipsis;
}
.auto { .auto {
flex: 1;
display: inline-flex; display: inline-flex;
gap: $unit-half; gap: $unit-half;
flex-direction: row; flex-direction: row;
margin-left: $unit-half; flex-wrap: nowrap;
} }
.fullAuto { .fullAuto {
color: var(--full-auto-label-text); color: var(--full-auto-label-text);
white-space: nowrap;
}
.extra {
color: var(--extra-purple-light-text);
white-space: nowrap;
} }
.autoGuard { .autoGuard {
display: inline-block;
width: 12px; width: 12px;
height: 12px; height: 12px;
@ -162,7 +191,6 @@
.raid { .raid {
color: var(--text-primary); color: var(--text-primary);
margin-bottom: calc($unit / 2);
&.empty { &.empty {
color: var(--text-tertiary); color: var(--text-tertiary);

View file

@ -26,7 +26,6 @@ interface Props {
autoGuard: boolean autoGuard: boolean
favorited: boolean favorited: boolean
createdAt: Date createdAt: Date
displayUser?: boolean | false
onClick: (shortcode: string) => void onClick: (shortcode: string) => void
onSave?: (partyId: string, favorited: boolean) => void onSave?: (partyId: string, favorited: boolean) => void
} }
@ -184,40 +183,24 @@ const GridRep = (props: Props) => {
function fullAutoString() { function fullAutoString() {
const fullAutoElement = ( const fullAutoElement = (
<span className="full_auto"> <span className={styles.fullAuto}>
{` · ${t('party.details.labels.full_auto')}`} {` · ${t('party.details.labels.full_auto')}`}
</span> </span>
) )
const autoGuardElement = ( const autoGuardElement = (
<span className="auto_guard"> <span className={styles.autoGuard}>
<ShieldIcon /> <ShieldIcon />
</span> </span>
) )
return ( return (
<div className="auto"> <div className={styles.auto}>
{fullAutoElement} {fullAutoElement}
{props.autoGuard ? autoGuardElement : ''} {props.autoGuard ? autoGuardElement : ''}
</div> </div>
) )
} }
const details = (
<div className="Details">
<h2 className={titleClass}>{props.name ? props.name : t('no_title')}</h2>
<div className="bottom">
<div className="Properties">
<span className={raidClass}>
{props.raid ? props.raid.name[locale] : t('no_raid')}
</span>
{props.fullAuto ? fullAutoString() : ''}
</div>
<time className="last-updated" dateTime={props.createdAt.toISOString()}>
{formatTimeAgo(props.createdAt, locale)}
</time>
</div>
</div>
)
const detailsWithUsername = ( const detailsWithUsername = (
<div className={styles.details}> <div className={styles.details}>
@ -230,12 +213,13 @@ const GridRep = (props: Props) => {
<span className={raidClass}> <span className={raidClass}>
{props.raid ? props.raid.name[locale] : t('no_raid')} {props.raid ? props.raid.name[locale] : t('no_raid')}
</span> </span>
{props.fullAuto ? ( {props.fullAuto && (
<span className={styles.fullAuto}> <span className={styles.fullAuto}>
{` · ${t('party.details.labels.full_auto')}`} {` · ${t('party.details.labels.full_auto')}`}
</span> </span>
) : ( )}
'' {props.raid && props.raid.group.extra && (
<span className={styles.extra}>{` · EX`}</span>
)} )}
</div> </div>
</div> </div>
@ -259,10 +243,13 @@ const GridRep = (props: Props) => {
'' ''
)} )}
</div> </div>
<div className={styles.bottom}> <div className={styles.attributed}>
{props.user ? linkedAttribution() : unlinkedAttribution()} {props.user ? linkedAttribution() : unlinkedAttribution()}
<time className="last-updated" dateTime={props.createdAt.toISOString()}> <time
className={styles.lastUpdated}
dateTime={props.createdAt.toISOString()}
>
{formatTimeAgo(props.createdAt, locale)} {formatTimeAgo(props.createdAt, locale)}
</time> </time>
</div> </div>
@ -272,7 +259,7 @@ const GridRep = (props: Props) => {
return ( return (
<Link href={`/p/${props.shortcode}`}> <Link href={`/p/${props.shortcode}`}>
<a className={styles.gridRep}> <a className={styles.gridRep}>
{props.displayUser ? detailsWithUsername : details} {detailsWithUsername}
<div className={styles.weaponGrid}> <div className={styles.weaponGrid}>
<div className={mainhandClasses}>{generateMainhandImage()}</div> <div className={mainhandClasses}>{generateMainhandImage()}</div>