Add arrow active state

This commit is contained in:
Melvin Valster
2019-07-22 22:58:32 +02:00
parent 1866951986
commit 0b4af07407
9 changed files with 40 additions and 17 deletions
+3 -1
View File
@@ -5,9 +5,10 @@ import classNames from 'classnames'
interface Props {
from: TalentData
to: TalentData
active?: boolean
}
export const Arrow: FC<Props> = ({ from, to }) => {
export const Arrow: FC<Props> = ({ from, to, active = false }) => {
const length = to.row === from.row
? Math.abs(to.col - from.col)
: to.row - from.row
@@ -19,6 +20,7 @@ export const Arrow: FC<Props> = ({ from, to }) => {
}
const className = classNames('arrow', {
'arrow--active': active,
'arrow--down': to.row > from.row,
'arrow--right': to.row === from.row && to.col > from.col,
'arrow--left': to.row === from.row && to.col < from.col,