diff --git a/components/HovercardHeader/index.module.scss b/components/HovercardHeader/index.module.scss index f547451b..55f85153 100644 --- a/components/HovercardHeader/index.module.scss +++ b/components/HovercardHeader/index.module.scss @@ -48,7 +48,12 @@ display: flex; flex-direction: row; flex-grow: 0; - gap: $unit; + gap: $unit-half; + + .proficiencies { + display: flex; + gap: $unit; + } } } } diff --git a/components/HovercardHeader/index.tsx b/components/HovercardHeader/index.tsx index 105d52ed..03266ab1 100644 --- a/components/HovercardHeader/index.tsx +++ b/components/HovercardHeader/index.tsx @@ -4,6 +4,7 @@ import UncapIndicator from '~components/uncap/UncapIndicator' import WeaponLabelIcon from '~components/weapon/WeaponLabelIcon' import styles from './index.module.scss' +import classNames from 'classnames' interface Props { gridObject: GridCharacter | GridSummon | GridWeapon @@ -107,6 +108,61 @@ const HovercardHeader = ({ gridObject, object, type, ...props }: Props) => { } } + const summonProficiency = ( +
+ +
+ ) + + const weaponProficiency = ( +
+ + {'proficiency' in object && !Array.isArray(object.proficiency) && ( + + )} +
+ ) + + const characterProficiency = ( +
+ + + {'proficiency' in object && Array.isArray(object.proficiency) && ( + + )} + + {'proficiency' in object && + Array.isArray(object.proficiency) && + object.proficiency.length > 1 && ( + + )} +
+ ) + + function proficiency() { + switch (type) { + case 'character': + return characterProficiency + case 'summon': + return summonProficiency + case 'weapon': + return weaponProficiency + } + } + return (
@@ -117,20 +173,7 @@ const HovercardHeader = ({ gridObject, object, type, ...props }: Props) => {
-
- - {'proficiency' in object && Array.isArray(object.proficiency) && ( - - )} - {'proficiency' in object && !Array.isArray(object.proficiency) && ( - - )} - {'proficiency' in object && - Array.isArray(object.proficiency) && - object.proficiency.length > 1 && ( - - )} -
+ {proficiency()} { @@ -13,6 +14,7 @@ const WeaponLabelIcon = (props: Props) => { const classes = classNames({ [styles.icon]: true, + [styles.small]: props.size === 'small', [styles[props.labelType]]: true, [styles.en]: router.locale === 'en', [styles.ja]: router.locale === 'ja', @@ -21,4 +23,8 @@ const WeaponLabelIcon = (props: Props) => { return } +WeaponLabelIcon.defaultProps = { + size: 'normal', +} + export default WeaponLabelIcon