Localize and modernize search result components
This commit is contained in:
parent
159110a807
commit
d0323861db
3 changed files with 69 additions and 61 deletions
|
|
@ -1,4 +1,6 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
import { useRouter } from 'next/router'
|
||||||
|
|
||||||
import UncapIndicator from '~components/UncapIndicator'
|
import UncapIndicator from '~components/UncapIndicator'
|
||||||
import WeaponLabelIcon from '~components/WeaponLabelIcon'
|
import WeaponLabelIcon from '~components/WeaponLabelIcon'
|
||||||
|
|
||||||
|
|
@ -11,15 +13,17 @@ interface Props {
|
||||||
|
|
||||||
const Element = ['null', 'wind', 'fire', 'water', 'earth', 'dark', 'light']
|
const Element = ['null', 'wind', 'fire', 'water', 'earth', 'dark', 'light']
|
||||||
|
|
||||||
class CharacterResult extends React.Component<Props> {
|
const CharacterResult = (props: Props) => {
|
||||||
render() {
|
const router = useRouter()
|
||||||
const character = this.props.data
|
const locale = (router.locale && ['en', 'ja'].includes(router.locale)) ? router.locale : 'en'
|
||||||
|
|
||||||
return (
|
const character = props.data
|
||||||
<li className="CharacterResult" onClick={this.props.onClick}>
|
|
||||||
<img alt={character.name.en} src={`${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/chara-grid/${character.granblue_id}_01.jpg`} />
|
return(
|
||||||
|
<li className="CharacterResult" onClick={props.onClick}>
|
||||||
|
<img alt={character.name[locale]} src={`${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/chara-grid/${character.granblue_id}_01.jpg`} />
|
||||||
<div className="Info">
|
<div className="Info">
|
||||||
<h5>{character.name.en}</h5>
|
<h5>{character.name[locale]}</h5>
|
||||||
<UncapIndicator
|
<UncapIndicator
|
||||||
type="character"
|
type="character"
|
||||||
flb={character.uncap.flb}
|
flb={character.uncap.flb}
|
||||||
|
|
@ -32,7 +36,6 @@ class CharacterResult extends React.Component<Props> {
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
)
|
)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default CharacterResult
|
export default CharacterResult
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
import { useRouter } from 'next/router'
|
||||||
|
|
||||||
import UncapIndicator from '~components/UncapIndicator'
|
import UncapIndicator from '~components/UncapIndicator'
|
||||||
import WeaponLabelIcon from '~components/WeaponLabelIcon'
|
import WeaponLabelIcon from '~components/WeaponLabelIcon'
|
||||||
|
|
||||||
|
|
@ -11,15 +13,17 @@ interface Props {
|
||||||
|
|
||||||
const Element = ['null', 'wind', 'fire', 'water', 'earth', 'dark', 'light']
|
const Element = ['null', 'wind', 'fire', 'water', 'earth', 'dark', 'light']
|
||||||
|
|
||||||
class SummonResult extends React.Component<Props> {
|
const SummonResult = (props: Props) => {
|
||||||
render() {
|
const router = useRouter()
|
||||||
const summon = this.props.data
|
const locale = (router.locale && ['en', 'ja'].includes(router.locale)) ? router.locale : 'en'
|
||||||
|
|
||||||
|
const summon = props.data
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<li className="SummonResult" onClick={this.props.onClick}>
|
<li className="SummonResult" onClick={props.onClick}>
|
||||||
<img alt={summon.name.en} src={`${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/summon-grid/${summon.granblue_id}.jpg`} />
|
<img alt={summon.name[locale]} src={`${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/summon-grid/${summon.granblue_id}.jpg`} />
|
||||||
<div className="Info">
|
<div className="Info">
|
||||||
<h5>{summon.name.en}</h5>
|
<h5>{summon.name[locale]}</h5>
|
||||||
<UncapIndicator
|
<UncapIndicator
|
||||||
type="summon"
|
type="summon"
|
||||||
flb={summon.uncap.flb}
|
flb={summon.uncap.flb}
|
||||||
|
|
@ -32,7 +36,6 @@ class SummonResult extends React.Component<Props> {
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
)
|
)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default SummonResult
|
export default SummonResult
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
import { useRouter } from 'next/router'
|
||||||
|
|
||||||
import UncapIndicator from '~components/UncapIndicator'
|
import UncapIndicator from '~components/UncapIndicator'
|
||||||
import WeaponLabelIcon from '~components/WeaponLabelIcon'
|
import WeaponLabelIcon from '~components/WeaponLabelIcon'
|
||||||
|
|
||||||
|
|
@ -13,15 +15,16 @@ const Element = ['null', 'wind', 'fire', 'water', 'earth', 'dark', 'light']
|
||||||
const Proficiency = ['none', 'sword', 'dagger', 'axe', 'spear', 'bow', 'staff', 'fist', 'harp', 'gun', 'katana']
|
const Proficiency = ['none', 'sword', 'dagger', 'axe', 'spear', 'bow', 'staff', 'fist', 'harp', 'gun', 'katana']
|
||||||
const Series = ['seraphic', 'grand', 'opus', 'draconic', 'revenant', 'primal', 'beast','regalia', 'omega', 'olden_primal', 'hollowsky', 'xeno', 'astral', 'rose', 'ultima', 'bahamut', 'epic', 'ennead', 'cosmos', 'ancestral', 'superlative', 'vintage', 'class_champion', 'sephira', 'new_world_foundation']
|
const Series = ['seraphic', 'grand', 'opus', 'draconic', 'revenant', 'primal', 'beast','regalia', 'omega', 'olden_primal', 'hollowsky', 'xeno', 'astral', 'rose', 'ultima', 'bahamut', 'epic', 'ennead', 'cosmos', 'ancestral', 'superlative', 'vintage', 'class_champion', 'sephira', 'new_world_foundation']
|
||||||
|
|
||||||
class WeaponResult extends React.Component<Props> {
|
const WeaponResult = (props: Props) => {
|
||||||
render() {
|
const router = useRouter()
|
||||||
const weapon = this.props.data
|
const locale = (router.locale && ['en', 'ja'].includes(router.locale)) ? router.locale : 'en'
|
||||||
|
const weapon = props.data
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<li className="WeaponResult" onClick={this.props.onClick}>
|
<li className="WeaponResult" onClick={props.onClick}>
|
||||||
<img alt={weapon.name.en} src={`${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/weapon-grid/${weapon.granblue_id}.jpg`} />
|
<img alt={weapon.name[locale]} src={`${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/weapon-grid/${weapon.granblue_id}.jpg`} />
|
||||||
<div className="Info">
|
<div className="Info">
|
||||||
<h5>{weapon.name.en}</h5>
|
<h5>{weapon.name[locale]}</h5>
|
||||||
<UncapIndicator
|
<UncapIndicator
|
||||||
type="weapon"
|
type="weapon"
|
||||||
flb={weapon.uncap.flb}
|
flb={weapon.uncap.flb}
|
||||||
|
|
@ -35,7 +38,6 @@ class WeaponResult extends React.Component<Props> {
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
)
|
)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default WeaponResult
|
export default WeaponResult
|
||||||
Loading…
Reference in a new issue