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 { useRouter } from 'next/router'
|
||||
|
||||
import UncapIndicator from '~components/UncapIndicator'
|
||||
import WeaponLabelIcon from '~components/WeaponLabelIcon'
|
||||
|
||||
|
|
@ -11,28 +13,29 @@ interface Props {
|
|||
|
||||
const Element = ['null', 'wind', 'fire', 'water', 'earth', 'dark', 'light']
|
||||
|
||||
class CharacterResult extends React.Component<Props> {
|
||||
render() {
|
||||
const character = this.props.data
|
||||
const CharacterResult = (props: Props) => {
|
||||
const router = useRouter()
|
||||
const locale = (router.locale && ['en', 'ja'].includes(router.locale)) ? router.locale : 'en'
|
||||
|
||||
return (
|
||||
<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`} />
|
||||
<div className="Info">
|
||||
<h5>{character.name.en}</h5>
|
||||
<UncapIndicator
|
||||
type="character"
|
||||
flb={character.uncap.flb}
|
||||
ulb={character.uncap.ulb}
|
||||
special={character.special}
|
||||
/>
|
||||
<div className="tags">
|
||||
<WeaponLabelIcon labelType={Element[character.element]} />
|
||||
</div>
|
||||
const character = props.data
|
||||
|
||||
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">
|
||||
<h5>{character.name[locale]}</h5>
|
||||
<UncapIndicator
|
||||
type="character"
|
||||
flb={character.uncap.flb}
|
||||
ulb={character.uncap.ulb}
|
||||
special={character.special}
|
||||
/>
|
||||
<div className="tags">
|
||||
<WeaponLabelIcon labelType={Element[character.element]} />
|
||||
</div>
|
||||
</li>
|
||||
)
|
||||
}
|
||||
</div>
|
||||
</li>
|
||||
)
|
||||
}
|
||||
|
||||
export default CharacterResult
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
import React from 'react'
|
||||
import { useRouter } from 'next/router'
|
||||
|
||||
import UncapIndicator from '~components/UncapIndicator'
|
||||
import WeaponLabelIcon from '~components/WeaponLabelIcon'
|
||||
|
||||
|
|
@ -11,28 +13,29 @@ interface Props {
|
|||
|
||||
const Element = ['null', 'wind', 'fire', 'water', 'earth', 'dark', 'light']
|
||||
|
||||
class SummonResult extends React.Component<Props> {
|
||||
render() {
|
||||
const summon = this.props.data
|
||||
const SummonResult = (props: Props) => {
|
||||
const router = useRouter()
|
||||
const locale = (router.locale && ['en', 'ja'].includes(router.locale)) ? router.locale : 'en'
|
||||
|
||||
return (
|
||||
<li className="SummonResult" onClick={this.props.onClick}>
|
||||
<img alt={summon.name.en} src={`${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/summon-grid/${summon.granblue_id}.jpg`} />
|
||||
<div className="Info">
|
||||
<h5>{summon.name.en}</h5>
|
||||
<UncapIndicator
|
||||
type="summon"
|
||||
flb={summon.uncap.flb}
|
||||
ulb={summon.uncap.ulb}
|
||||
special={false}
|
||||
/>
|
||||
<div className="tags">
|
||||
<WeaponLabelIcon labelType={Element[summon.element]} />
|
||||
</div>
|
||||
const summon = props.data
|
||||
|
||||
return (
|
||||
<li className="SummonResult" onClick={props.onClick}>
|
||||
<img alt={summon.name[locale]} src={`${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/summon-grid/${summon.granblue_id}.jpg`} />
|
||||
<div className="Info">
|
||||
<h5>{summon.name[locale]}</h5>
|
||||
<UncapIndicator
|
||||
type="summon"
|
||||
flb={summon.uncap.flb}
|
||||
ulb={summon.uncap.ulb}
|
||||
special={false}
|
||||
/>
|
||||
<div className="tags">
|
||||
<WeaponLabelIcon labelType={Element[summon.element]} />
|
||||
</div>
|
||||
</li>
|
||||
)
|
||||
}
|
||||
</div>
|
||||
</li>
|
||||
)
|
||||
}
|
||||
|
||||
export default SummonResult
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
import React from 'react'
|
||||
import { useRouter } from 'next/router'
|
||||
|
||||
import UncapIndicator from '~components/UncapIndicator'
|
||||
import WeaponLabelIcon from '~components/WeaponLabelIcon'
|
||||
|
||||
|
|
@ -13,29 +15,29 @@ const Element = ['null', 'wind', 'fire', 'water', 'earth', 'dark', 'light']
|
|||
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']
|
||||
|
||||
class WeaponResult extends React.Component<Props> {
|
||||
render() {
|
||||
const weapon = this.props.data
|
||||
const WeaponResult = (props: Props) => {
|
||||
const router = useRouter()
|
||||
const locale = (router.locale && ['en', 'ja'].includes(router.locale)) ? router.locale : 'en'
|
||||
const weapon = props.data
|
||||
|
||||
return (
|
||||
<li className="WeaponResult" onClick={this.props.onClick}>
|
||||
<img alt={weapon.name.en} src={`${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/weapon-grid/${weapon.granblue_id}.jpg`} />
|
||||
<div className="Info">
|
||||
<h5>{weapon.name.en}</h5>
|
||||
<UncapIndicator
|
||||
type="weapon"
|
||||
flb={weapon.uncap.flb}
|
||||
ulb={weapon.uncap.ulb}
|
||||
special={false}
|
||||
/>
|
||||
<div className="tags">
|
||||
<WeaponLabelIcon labelType={Element[weapon.element]} />
|
||||
<WeaponLabelIcon labelType={Proficiency[weapon.proficiency]} />
|
||||
</div>
|
||||
return (
|
||||
<li className="WeaponResult" onClick={props.onClick}>
|
||||
<img alt={weapon.name[locale]} src={`${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/weapon-grid/${weapon.granblue_id}.jpg`} />
|
||||
<div className="Info">
|
||||
<h5>{weapon.name[locale]}</h5>
|
||||
<UncapIndicator
|
||||
type="weapon"
|
||||
flb={weapon.uncap.flb}
|
||||
ulb={weapon.uncap.ulb}
|
||||
special={false}
|
||||
/>
|
||||
<div className="tags">
|
||||
<WeaponLabelIcon labelType={Element[weapon.element]} />
|
||||
<WeaponLabelIcon labelType={Proficiency[weapon.proficiency]} />
|
||||
</div>
|
||||
</li>
|
||||
)
|
||||
}
|
||||
</div>
|
||||
</li>
|
||||
)
|
||||
}
|
||||
|
||||
export default WeaponResult
|
||||
Loading…
Reference in a new issue