Use Link on GridRep
* Open grids in new tab * Can favorite or open grid still * Can now navigate to profile from grid collection
This commit is contained in:
parent
3acd2fa262
commit
5130f52f61
4 changed files with 67 additions and 34 deletions
|
|
@ -99,6 +99,10 @@
|
||||||
.bottom {
|
.bottom {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
|
||||||
|
a.user:hover {
|
||||||
|
color: var(--link-text-hover);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.raid,
|
.raid,
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import React, { useEffect, useState } from 'react'
|
import React, { useEffect, useState } from 'react'
|
||||||
|
import Link from 'next/link'
|
||||||
import { useRouter } from 'next/router'
|
import { useRouter } from 'next/router'
|
||||||
import { useSnapshot } from 'valtio'
|
import { useSnapshot } from 'valtio'
|
||||||
import { useTranslation } from 'next-i18next'
|
import { useTranslation } from 'next-i18next'
|
||||||
|
|
@ -132,11 +133,28 @@ const GridRep = (props: Props) => {
|
||||||
} else return <div className="no-user" />
|
} else return <div className="no-user" />
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const linkedAttribution = () => (
|
||||||
|
<Link href={`/${props.user ? props.user.username : '#'}`}>
|
||||||
|
<a
|
||||||
|
className={userClass}
|
||||||
|
href={`/${props.user ? props.user.username : '#'}`}
|
||||||
|
>
|
||||||
|
{userImage()}
|
||||||
|
{props.user ? props.user.username : t('no_user')}
|
||||||
|
</a>
|
||||||
|
</Link>
|
||||||
|
)
|
||||||
|
|
||||||
|
const unlinkedAttribution = () => (
|
||||||
|
<div className={userClass}>
|
||||||
|
{userImage()}
|
||||||
|
{props.user ? props.user.username : t('no_user')}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
|
||||||
const details = (
|
const details = (
|
||||||
<div className="Details">
|
<div className="Details">
|
||||||
<h2 className={titleClass} onClick={navigate}>
|
<h2 className={titleClass}>{props.name ? props.name : t('no_title')}</h2>
|
||||||
{props.name ? props.name : t('no_title')}
|
|
||||||
</h2>
|
|
||||||
<div className="bottom">
|
<div className="bottom">
|
||||||
<div className={raidClass}>
|
<div className={raidClass}>
|
||||||
{props.raid ? props.raid.name[locale] : t('no_raid')}
|
{props.raid ? props.raid.name[locale] : t('no_raid')}
|
||||||
|
|
@ -152,7 +170,7 @@ const GridRep = (props: Props) => {
|
||||||
<div className="Details">
|
<div className="Details">
|
||||||
<div className="top">
|
<div className="top">
|
||||||
<div className="info">
|
<div className="info">
|
||||||
<h2 className={titleClass} onClick={navigate}>
|
<h2 className={titleClass}>
|
||||||
{props.name ? props.name : t('no_title')}
|
{props.name ? props.name : t('no_title')}
|
||||||
</h2>
|
</h2>
|
||||||
<div className={raidClass}>
|
<div className={raidClass}>
|
||||||
|
|
@ -162,23 +180,25 @@ const GridRep = (props: Props) => {
|
||||||
{account.authorized &&
|
{account.authorized &&
|
||||||
((props.user && account.user && account.user.id !== props.user.id) ||
|
((props.user && account.user && account.user.id !== props.user.id) ||
|
||||||
!props.user) ? (
|
!props.user) ? (
|
||||||
<Button
|
<Link href="#">
|
||||||
className="Save"
|
<a href="#">
|
||||||
accessoryIcon={<SaveIcon className="stroke" />}
|
<Button
|
||||||
active={props.favorited}
|
className="Save"
|
||||||
contained={true}
|
accessoryIcon={<SaveIcon className="stroke" />}
|
||||||
buttonSize="small"
|
active={props.favorited}
|
||||||
onClick={sendSaveData}
|
contained={true}
|
||||||
/>
|
buttonSize="small"
|
||||||
|
onClick={sendSaveData}
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
|
</Link>
|
||||||
) : (
|
) : (
|
||||||
''
|
''
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="bottom">
|
<div className="bottom">
|
||||||
<div className={userClass}>
|
{props.user ? linkedAttribution() : unlinkedAttribution()}
|
||||||
{userImage()}
|
|
||||||
{props.user ? props.user.username : t('no_user')}
|
|
||||||
</div>
|
|
||||||
<time className="last-updated" dateTime={props.createdAt.toISOString()}>
|
<time className="last-updated" dateTime={props.createdAt.toISOString()}>
|
||||||
{formatTimeAgo(props.createdAt, locale)}
|
{formatTimeAgo(props.createdAt, locale)}
|
||||||
</time>
|
</time>
|
||||||
|
|
@ -187,25 +207,27 @@ const GridRep = (props: Props) => {
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="GridRep">
|
<Link href={`/p/${props.shortcode}`}>
|
||||||
{props.displayUser ? detailsWithUsername : details}
|
<a className="GridRep">
|
||||||
<div className="Grid" onClick={navigate}>
|
{props.displayUser ? detailsWithUsername : details}
|
||||||
<div className="weapon grid_mainhand">{generateMainhandImage()}</div>
|
<div className="Grid">
|
||||||
|
<div className="weapon grid_mainhand">{generateMainhandImage()}</div>
|
||||||
|
|
||||||
<ul className="grid_weapons">
|
<ul className="grid_weapons">
|
||||||
{Array.from(Array(numWeapons)).map((x, i) => {
|
{Array.from(Array(numWeapons)).map((x, i) => {
|
||||||
return (
|
return (
|
||||||
<li
|
<li
|
||||||
key={`${props.shortcode}-${i}`}
|
key={`${props.shortcode}-${i}`}
|
||||||
className="weapon grid_weapon"
|
className="weapon grid_weapon"
|
||||||
>
|
>
|
||||||
{generateGridImage(i)}
|
{generateGridImage(i)}
|
||||||
</li>
|
</li>
|
||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</a>
|
||||||
|
</Link>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,8 @@
|
||||||
--card-bg: #{$grey-100};
|
--card-bg: #{$grey-100};
|
||||||
--bar-bg: #{$grey-100};
|
--bar-bg: #{$grey-100};
|
||||||
|
|
||||||
|
--link-text-hover: #{$text--link--hover--light};
|
||||||
|
|
||||||
// Light - Menus
|
// Light - Menus
|
||||||
--dialog-bg: #{$dialog--bg--light};
|
--dialog-bg: #{$dialog--bg--light};
|
||||||
|
|
||||||
|
|
@ -120,6 +122,8 @@
|
||||||
--card-bg: #{$page--element--bg--dark};
|
--card-bg: #{$page--element--bg--dark};
|
||||||
--bar-bg: #{$grey-10};
|
--bar-bg: #{$grey-10};
|
||||||
|
|
||||||
|
--link-text-hover: #{$text--link--hover--dark};
|
||||||
|
|
||||||
// Dark - Dialogs
|
// Dark - Dialogs
|
||||||
--dialog-bg: #{$dialog--bg--dark};
|
--dialog-bg: #{$dialog--bg--dark};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -235,6 +235,9 @@ $text--tertiary--color--dark: $grey-50;
|
||||||
$text--tertiary--hover--light: $grey-40;
|
$text--tertiary--hover--light: $grey-40;
|
||||||
$text--tertiary--hover--dark: $grey-70;
|
$text--tertiary--hover--dark: $grey-70;
|
||||||
|
|
||||||
|
$text--link--hover--light: $grey-40;
|
||||||
|
$text--link--hover--dark: $grey-100;
|
||||||
|
|
||||||
// Color Definitions: Icon
|
// Color Definitions: Icon
|
||||||
$icon--secondary--color--light: $grey-70;
|
$icon--secondary--color--light: $grey-70;
|
||||||
$icon--secondary--color--dark: $grey-50;
|
$icon--secondary--color--dark: $grey-50;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue