Implement new stars

This commit is contained in:
Justin Edmund 2022-01-25 23:18:01 -08:00
parent b2daead1d5
commit e2ff4fd432
4 changed files with 54 additions and 12 deletions

View file

@ -7,4 +7,8 @@
list-style: none; list-style: none;
margin: 0; margin: 0;
padding: 0; padding: 0;
&:hover {
cursor: pointer;
}
} }

View file

@ -1,5 +1,4 @@
import React from 'react' import React, { useState } from 'react'
import classnames from 'classnames'
import UncapStar from '~components/UncapStar' import UncapStar from '~components/UncapStar'
import './index.scss' import './index.scss'
@ -36,11 +35,14 @@ const UncapIndicator = (props: Props) => {
<ul className="UncapIndicator"> <ul className="UncapIndicator">
{ {
Array.from(Array(numStars)).map((x, i) => { Array.from(Array(numStars)).map((x, i) => {
if (props.type === 'character' && i > 3 || if (props.type === 'character' && i > 4) {
return <UncapStar ulb={true} key={`star_${i}`} />
} else if (
props.type === 'character' && i == 4 ||
props.type !== 'character' && i > 2) { props.type !== 'character' && i > 2) {
return <UncapStar uncap={true} key={`star_${i}`} /> return <UncapStar flb={true} key={`star_${i}`} />
} else { } else {
return <UncapStar uncap={false} key={`star_${i}`} /> return <UncapStar key={`star_${i}`} />
} }
}) })
} }

View file

@ -1,7 +1,31 @@
.UncapStar { .UncapStar {
color: #FFA15E; background-repeat: no-repeat;
} background-size: 18px 18px;
display: block;
height: 18px;
width: 18px;
.UncapStar.uncap { &:hover {
color: #65DAFF; transform: scale(1.2);
}
&.empty {
background: url('/icons/uncap/empty.svg');
}
&.mlb {
background: url('/icons/uncap/yellow.svg')
}
&.special {
background: url('/icons/uncap/red.svg')
}
&.flb {
background: url('/icons/uncap/blue.svg')
}
&.ulb {
background: url('/icons/uncap/purple.svg')
}
} }

View file

@ -4,13 +4,19 @@ import classnames from 'classnames'
import './index.scss' import './index.scss'
interface Props { interface Props {
uncap: boolean special: boolean
flb: boolean
ulb: boolean
} }
const UncapStar = (props: Props) => { const UncapStar = (props: Props) => {
const classes = classnames({ const classes = classnames({
UncapStar: true, UncapStar: true,
'uncap': props.uncap 'special': props.special,
'mlb': !props.special,
'flb': props.flb,
'ulb': props.ulb
}) })
return ( return (
@ -18,4 +24,10 @@ const UncapStar = (props: Props) => {
) )
} }
UncapStar.defaultProps = {
special: false,
flb: false,
ulb: false
}
export default UncapStar export default UncapStar