Use Buttons instead of <a>
This commit is contained in:
parent
0a5f0458c2
commit
2ef1863637
3 changed files with 59 additions and 23 deletions
|
|
@ -1,12 +1,14 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { useRouter } from 'next/router'
|
import { useRouter } from 'next/router'
|
||||||
import { useTranslation } from 'next-i18next'
|
import { useTranslation } from 'next-i18next'
|
||||||
|
import jconv from 'jconv'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Hovercard,
|
Hovercard,
|
||||||
HovercardContent,
|
HovercardContent,
|
||||||
HovercardTrigger,
|
HovercardTrigger,
|
||||||
} from '~components/Hovercard'
|
} from '~components/Hovercard'
|
||||||
|
import Button from '~components/Button'
|
||||||
import WeaponLabelIcon from '~components/WeaponLabelIcon'
|
import WeaponLabelIcon from '~components/WeaponLabelIcon'
|
||||||
import UncapIndicator from '~components/UncapIndicator'
|
import UncapIndicator from '~components/UncapIndicator'
|
||||||
|
|
||||||
|
|
@ -15,10 +17,10 @@ import {
|
||||||
aetherialMastery,
|
aetherialMastery,
|
||||||
permanentMastery,
|
permanentMastery,
|
||||||
} from '~data/overMastery'
|
} from '~data/overMastery'
|
||||||
|
import { characterAwakening } from '~data/awakening'
|
||||||
import { ExtendedMastery } from '~types'
|
import { ExtendedMastery } from '~types'
|
||||||
|
|
||||||
import './index.scss'
|
import './index.scss'
|
||||||
import { characterAwakening } from '~data/awakening'
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
gridCharacter: GridCharacter
|
gridCharacter: GridCharacter
|
||||||
|
|
@ -55,10 +57,13 @@ const CharacterHovercard = (props: Props) => {
|
||||||
]
|
]
|
||||||
|
|
||||||
const tintElement = Element[props.gridCharacter.object.element]
|
const tintElement = Element[props.gridCharacter.object.element]
|
||||||
const wikiUrl = `https://gbf.wiki/${props.gridCharacter.object.name.en.replaceAll(
|
|
||||||
' ',
|
function goTo() {
|
||||||
'_'
|
const urlSafeName = props.gridCharacter.object.name.en.replaceAll(' ', '_')
|
||||||
)}`
|
const url = `https://gbf.wiki/${urlSafeName}`
|
||||||
|
|
||||||
|
window.open(url, '_blank')
|
||||||
|
}
|
||||||
|
|
||||||
function characterImage() {
|
function characterImage() {
|
||||||
let imgSrc = ''
|
let imgSrc = ''
|
||||||
|
|
@ -85,7 +90,7 @@ const CharacterHovercard = (props: Props) => {
|
||||||
|
|
||||||
if (canonicalMastery) {
|
if (canonicalMastery) {
|
||||||
return (
|
return (
|
||||||
<li className="ExtendedMastery">
|
<li className="ExtendedMastery" key={canonicalMastery.id}>
|
||||||
<img
|
<img
|
||||||
alt={canonicalMastery.name[locale]}
|
alt={canonicalMastery.name[locale]}
|
||||||
src={`${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/mastery/${canonicalMastery.slug}.png`}
|
src={`${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/mastery/${canonicalMastery.slug}.png`}
|
||||||
|
|
@ -200,6 +205,15 @@ const CharacterHovercard = (props: Props) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const wikiButton = (
|
||||||
|
<Button
|
||||||
|
className={tintElement}
|
||||||
|
text={t('buttons.wiki')}
|
||||||
|
onClick={goTo}
|
||||||
|
contained={true}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Hovercard openDelay={350}>
|
<Hovercard openDelay={350}>
|
||||||
<HovercardTrigger asChild onClick={props.onTriggerClick}>
|
<HovercardTrigger asChild onClick={props.onTriggerClick}>
|
||||||
|
|
@ -242,19 +256,16 @@ const CharacterHovercard = (props: Props) => {
|
||||||
type="character"
|
type="character"
|
||||||
ulb={props.gridCharacter.object.uncap.ulb || false}
|
ulb={props.gridCharacter.object.uncap.ulb || false}
|
||||||
flb={props.gridCharacter.object.uncap.flb || false}
|
flb={props.gridCharacter.object.uncap.flb || false}
|
||||||
special={false}
|
transcendenceStage={props.gridCharacter.transcendence_step}
|
||||||
|
special={props.gridCharacter.object.special}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{wikiButton}
|
||||||
{awakeningSection()}
|
{awakeningSection()}
|
||||||
{overMasterySection()}
|
{overMasterySection()}
|
||||||
{aetherialMasterySection()}
|
{aetherialMasterySection()}
|
||||||
{permanentMasterySection()}
|
{permanentMasterySection()}
|
||||||
<section className="Footer">
|
|
||||||
<a className={`Button ${tintElement}`} href={wikiUrl} target="_new">
|
|
||||||
{t('buttons.wiki')}
|
|
||||||
</a>
|
|
||||||
</section>
|
|
||||||
</HovercardContent>
|
</HovercardContent>
|
||||||
</Hovercard>
|
</Hovercard>
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import {
|
||||||
HovercardContent,
|
HovercardContent,
|
||||||
HovercardTrigger,
|
HovercardTrigger,
|
||||||
} from '~components/Hovercard'
|
} from '~components/Hovercard'
|
||||||
|
import Button from '~components/Button'
|
||||||
import WeaponLabelIcon from '~components/WeaponLabelIcon'
|
import WeaponLabelIcon from '~components/WeaponLabelIcon'
|
||||||
import UncapIndicator from '~components/UncapIndicator'
|
import UncapIndicator from '~components/UncapIndicator'
|
||||||
|
|
||||||
|
|
@ -27,10 +28,13 @@ const SummonHovercard = (props: Props) => {
|
||||||
const Element = ['null', 'wind', 'fire', 'water', 'earth', 'dark', 'light']
|
const Element = ['null', 'wind', 'fire', 'water', 'earth', 'dark', 'light']
|
||||||
|
|
||||||
const tintElement = Element[props.gridSummon.object.element]
|
const tintElement = Element[props.gridSummon.object.element]
|
||||||
const wikiUrl = `https://gbf.wiki/${props.gridSummon.object.name.en.replaceAll(
|
|
||||||
' ',
|
function goTo() {
|
||||||
'_'
|
const urlSafeName = props.gridSummon.object.name.en.replaceAll(' ', '_')
|
||||||
)}`
|
const url = `https://gbf.wiki/${urlSafeName}`
|
||||||
|
|
||||||
|
window.open(url, '_blank')
|
||||||
|
}
|
||||||
|
|
||||||
function summonImage() {
|
function summonImage() {
|
||||||
let imgSrc = ''
|
let imgSrc = ''
|
||||||
|
|
@ -63,6 +67,15 @@ const SummonHovercard = (props: Props) => {
|
||||||
return imgSrc
|
return imgSrc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const wikiButton = (
|
||||||
|
<Button
|
||||||
|
className={tintElement}
|
||||||
|
text={t('buttons.wiki')}
|
||||||
|
onClick={goTo}
|
||||||
|
contained={true}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Hovercard openDelay={350}>
|
<Hovercard openDelay={350}>
|
||||||
<HovercardTrigger asChild onClick={props.onTriggerClick}>
|
<HovercardTrigger asChild onClick={props.onTriggerClick}>
|
||||||
|
|
@ -91,9 +104,7 @@ const SummonHovercard = (props: Props) => {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<a className={`Button ${tintElement}`} href={wikiUrl} target="_new">
|
{wikiButton}
|
||||||
{t('buttons.wiki')}
|
|
||||||
</a>
|
|
||||||
</HovercardContent>
|
</HovercardContent>
|
||||||
</Hovercard>
|
</Hovercard>
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import {
|
||||||
HovercardContent,
|
HovercardContent,
|
||||||
HovercardTrigger,
|
HovercardTrigger,
|
||||||
} from '~components/Hovercard'
|
} from '~components/Hovercard'
|
||||||
|
import Button from '~components/Button'
|
||||||
import WeaponLabelIcon from '~components/WeaponLabelIcon'
|
import WeaponLabelIcon from '~components/WeaponLabelIcon'
|
||||||
import UncapIndicator from '~components/UncapIndicator'
|
import UncapIndicator from '~components/UncapIndicator'
|
||||||
|
|
||||||
|
|
@ -79,6 +80,13 @@ const WeaponHovercard = (props: Props) => {
|
||||||
'_'
|
'_'
|
||||||
)}`
|
)}`
|
||||||
|
|
||||||
|
function goTo() {
|
||||||
|
const urlSafeName = props.gridWeapon.object.name.en.replaceAll(' ', '_')
|
||||||
|
const url = `https://gbf.wiki/${urlSafeName}`
|
||||||
|
|
||||||
|
window.open(url, '_blank')
|
||||||
|
}
|
||||||
|
|
||||||
const hovercardSide = () => {
|
const hovercardSide = () => {
|
||||||
if (props.gridWeapon.position == -1) return 'right'
|
if (props.gridWeapon.position == -1) return 'right'
|
||||||
else if ([6, 7, 8, 9, 10, 11].includes(props.gridWeapon.position))
|
else if ([6, 7, 8, 9, 10, 11].includes(props.gridWeapon.position))
|
||||||
|
|
@ -222,6 +230,15 @@ const WeaponHovercard = (props: Props) => {
|
||||||
</section>
|
</section>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const wikiButton = (
|
||||||
|
<Button
|
||||||
|
className={tintElement}
|
||||||
|
text={t('buttons.wiki')}
|
||||||
|
onClick={goTo}
|
||||||
|
contained={true}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Hovercard openDelay={350}>
|
<Hovercard openDelay={350}>
|
||||||
<HovercardTrigger asChild onClick={props.onTriggerClick}>
|
<HovercardTrigger asChild onClick={props.onTriggerClick}>
|
||||||
|
|
@ -275,10 +292,7 @@ const WeaponHovercard = (props: Props) => {
|
||||||
{props.gridWeapon.weapon_keys && props.gridWeapon.weapon_keys.length > 0
|
{props.gridWeapon.weapon_keys && props.gridWeapon.weapon_keys.length > 0
|
||||||
? keysSection
|
? keysSection
|
||||||
: ''}
|
: ''}
|
||||||
|
{wikiButton}
|
||||||
<a className={`Button ${tintElement}`} href={wikiUrl} target="_new">
|
|
||||||
{t('buttons.wiki')}
|
|
||||||
</a>
|
|
||||||
</HovercardContent>
|
</HovercardContent>
|
||||||
</Hovercard>
|
</Hovercard>
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue