From 320bbf9f3aa3d919ad24be3f0c5589cc28724aa4 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Mon, 19 Oct 2020 05:12:08 -0700 Subject: [PATCH] Add CharacterResult --- src/components/CharacterResult/index.css | 48 ++++++++++++++++++++++++ src/components/CharacterResult/index.tsx | 41 ++++++++++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 src/components/CharacterResult/index.css create mode 100644 src/components/CharacterResult/index.tsx diff --git a/src/components/CharacterResult/index.css b/src/components/CharacterResult/index.css new file mode 100644 index 00000000..07d38053 --- /dev/null +++ b/src/components/CharacterResult/index.css @@ -0,0 +1,48 @@ +.CharacterResult { + -webkit-font-smoothing: antialiased; + + border-radius: 6px; + display: flex; + font-family: -apple-system, "Helvetica Neue", "Lucida Grande"; + gap: 8px; + padding: 12px; +} + +.CharacterResult img { + background: #e9e9e9; + border-radius: 6px; + display: inline-block; + height: 72px; + width: 120px; +} + +.CharacterResult h5 { + color: #555; + display: inline-block; + font-size: 18px; + font-weight: 500; + margin: 2px 4px 4px 0; +} + +.CharacterResult .WeaponLabelIcon { + margin-right: 4px; +} + +.CharacterResult .stars { + display: inline-block; + color: #FFA15E; + font-size: 21px; +} + +.CharacterResult .stars > span { + color: #65DAFF; +} + +.CharacterResult:hover { + background: #e9e9e9; + cursor: pointer; +} + +.CharacterResult:hover .image_placeholder { + background: #dadada; +} \ No newline at end of file diff --git a/src/components/CharacterResult/index.tsx b/src/components/CharacterResult/index.tsx new file mode 100644 index 00000000..8126f452 --- /dev/null +++ b/src/components/CharacterResult/index.tsx @@ -0,0 +1,41 @@ +import React from 'react' +import WeaponLabelIcon from '~components/WeaponLabelIcon' + +import images from '../../images/chara-grid/*.jpg' + +import './index.css' + +interface Props { + data: Character + onClick: () => void +} + +const Element = ['null', 'wind', 'fire', 'water', 'earth', 'dark', 'light'] + +class CharacterResult extends React.Component { + render() { + let imgSrc + + const character = this.props.data + if (process.env.NODE_ENV === 'development') { + imgSrc = images[character.granblue_id] + } else if (process.env.NODE_ENV === 'production') { + imgSrc = `${process.env.SIERO_IMG_URL}/chara-grid/${character.granblue_id}.jpg` + } + + return ( +
  • + {character.name.en} +
    +
    +
    {character.name.en}
    +
    {(character.rarity == 2) ? '⭑⭑⭑' : '⭑⭑⭑⭑'}{(character.uncap.flb) ? : ''}
    +
    + +
    +
  • + ) + } +} + +export default CharacterResult \ No newline at end of file