From 8302af75042517b5aea3f1563cd19b411ec4b0ad Mon Sep 17 00:00:00 2001 From: Melvin Valster Date: Sun, 21 Jul 2019 22:36:46 +0200 Subject: [PATCH] Add active/inactive styling to ClassPicker --- TODO.md | 4 ++-- src/App.scss | 22 ++++++++++++++------ src/components/ClassPicker.tsx | 37 ++++++++++++++++++++++++++-------- src/components/IndexRoute.tsx | 24 +++++++++------------- src/data/classes.ts | 7 ------- src/lib/tree.ts | 20 +++++++++--------- src/types.d.ts | 7 +++++++ 7 files changed, 73 insertions(+), 48 deletions(-) diff --git a/TODO.md b/TODO.md index a8a9b73..9180373 100644 --- a/TODO.md +++ b/TODO.md @@ -1,10 +1,10 @@ # TODO - [ ] Add redux -- [ ] Prevent reducing talent points on a talent that is a requirement for another talent with points in it - [ ] Talent tooltips - [ ] Generate URL for chosen talents - [ ] Responsive on mobile - [ ] Pretty ClassPicker - [x] Add react-router -- [x] Prevent reducing talent points on a row when it is a dependency for points already spent in the next row \ No newline at end of file +- [x] Prevent reducing talent points on a row when it is a dependency for points already spent in the next row +- [x] Prevent reducing talent points on a talent that is a requirement for another talent with points in it diff --git a/src/App.scss b/src/App.scss index d48cb51..55eba5e 100644 --- a/src/App.scss +++ b/src/App.scss @@ -3,7 +3,6 @@ body { } .calculator { - &__points { color: white; text-align: center; @@ -40,15 +39,26 @@ body { .class-picker { display: flex; + justify-content: center; &__class { margin-right: 2em; - } + opacity: .8; - // TODO: Make BEM - a { - &.active { - font-weight: bold; + &:hover { + opacity: 1; + } + + &--active { + opacity: 1; + } + + &--inactive { + opacity: .4; + + &:hover { + opacity: .6; + } } } } \ No newline at end of file diff --git a/src/components/ClassPicker.tsx b/src/components/ClassPicker.tsx index 374e451..0bc3b57 100644 --- a/src/components/ClassPicker.tsx +++ b/src/components/ClassPicker.tsx @@ -1,18 +1,39 @@ import React from 'react' -import { NavLink } from 'react-router-dom' +import { NavLink, Link } from 'react-router-dom' import { classByName } from '../data/classes' +import { Icon } from './Icon' +import classNames from 'classnames' interface Props { + /** Name of the selected class, lowercase */ + selected?: string } -export const ClassPicker: React.FC = () => { - return ( -