diff --git a/TODO.md b/TODO.md index 2663040..cfa6319 100644 --- a/TODO.md +++ b/TODO.md @@ -5,6 +5,7 @@ - [ ] General: Responsive on mobile - [ ] Talent tree: Reset button per tree (?) - [ ] Fix: Initial load `pointString` validation (make sure all talents are valid and their deps are met) +- [ ] Fix: Arrow should start underneath the icon - [x] Talent tree: Arrows for dependencies - [x] System: Generate URL for chosen talents - [x] Talent tree: Prettier talent frames diff --git a/src/App.scss b/src/App.scss index d7bc0f5..b35cda8 100644 --- a/src/App.scss +++ b/src/App.scss @@ -1,10 +1,33 @@ @import "sass/config"; body { + color: white; background-color: #111; font-family: Verdana; } +a { + text-decoration: none; + color: pink; + + &:hover { + color: lighten(pink, 50%); + } +} + +.container { + max-width: 900px; + margin: 0 auto; +} + +.inline-items { + display: flex; + + & > * { + margin-right: 1em; + } +} + .calculator { &__points { color: white; @@ -48,10 +71,13 @@ body { .class-picker { display: flex; - justify-content: center; list-style: none; - margin-top: 2em; - margin-bottom: 2em; + padding: 0; + margin: 2em 0; + + &--center { + justify-content: center; + } &__class { margin-right: 1em; diff --git a/src/App.tsx b/src/App.tsx index 509664a..aaf4595 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,14 +1,18 @@ import React from 'react' import './App.scss' import { IndexRoute } from './components/IndexRoute' -import { BrowserRouter as Router, Route } from 'react-router-dom' +import { PlaygroundRoute } from './components/PlaygroundRoute' +import { BrowserRouter as Router, Route, Switch } from 'react-router-dom' const App: React.FC = () => { return ( {/* */}
- + + + +
); diff --git a/src/components/Arrow.scss b/src/components/Arrow.scss index a19ffc1..3100081 100644 --- a/src/components/Arrow.scss +++ b/src/components/Arrow.scss @@ -110,8 +110,7 @@ } } - &--right-down, - &--left-down { + &--side-down { // Position based on row @for $i from 0 through 6 { &[data-row="#{$i}"] { diff --git a/src/components/Arrow.tsx b/src/components/Arrow.tsx index 926b70d..b6c482e 100644 --- a/src/components/Arrow.tsx +++ b/src/components/Arrow.tsx @@ -31,7 +31,7 @@ export const Arrow: FC = ({ from, to, active = false }) => { const height = to.row - from.row const width = Math.abs(to.col - from.col) - + const dir = getDirection(from, to) if (dir === 'right-down' || dir === 'left-down') { props['data-height'] = height @@ -42,6 +42,7 @@ export const Arrow: FC = ({ from, to, active = false }) => { const className = classNames('arrow', `arrow--${dir}`, { 'arrow--active': active, + 'arrow--side-down': dir === 'right-down' || dir === 'left-down' }) return
diff --git a/src/components/Calculator.tsx b/src/components/Calculator.tsx index 68b8e42..463b76d 100644 --- a/src/components/Calculator.tsx +++ b/src/components/Calculator.tsx @@ -99,8 +99,7 @@ export class Calculator extends React.PureComponent {
) diff --git a/src/components/ClassPicker.tsx b/src/components/ClassPicker.tsx index aa6fbc6..d773c33 100644 --- a/src/components/ClassPicker.tsx +++ b/src/components/ClassPicker.tsx @@ -7,6 +7,7 @@ import classNames from 'classnames' interface Props { /** Name of the selected class, lowercase */ selected?: string + center?: boolean } const classNameForItem = (c: ClassData, selected: string) => classNames('class-picker__class', { @@ -18,10 +19,11 @@ export class ClassPicker extends React.PureComponent { static whyDidYouRender = true render() { - const { selected } = this.props + const { selected, center = false } = this.props const cn = classNames('class-picker', { - 'class-picker--has-selection': !!selected + 'class-picker--has-selection': !!selected, + 'class-picker--center': center, }) return ( diff --git a/src/components/Icon.scss b/src/components/Icon.scss index fbd99c8..9bfd333 100644 --- a/src/components/Icon.scss +++ b/src/components/Icon.scss @@ -1,11 +1,34 @@ @import "../sass/_config"; +@mixin icon-size($size) { + $offset: $size * 0.1; + + width: $size; + height: $size; + + .icon__bg { + width: ceil($size - $offset); + height: ceil($size - $offset); + border-radius: $size / 8; + top: $size * 0.05; + left: $size * 0.05; + } + + .icon__frame { + width: $size + $offset; + height: $size + $offset; + top: -($offset * .5); + left: -($offset * .5); + } +} + .icon { position: relative; background-position: center; background-repeat: no-repeat; background-size: contain; background-color: #222; + border-radius: 5px; &:hover { .icon__bg { @@ -19,17 +42,16 @@ } } - &--medium { - width: 40px; - height: 40px; - border-radius: 5px; + &--small { + @include icon-size(20px); + } - .icon__bg { - width: 36px; - height: 36px; - top: 2px; - left: 2px; - } + &--medium { + @include icon-size(40px); + } + + &--large { + @include icon-size(60px); } &--golden { @@ -47,17 +69,12 @@ &__bg { position: absolute; background-size: cover; - border-radius: 5px; opacity: 1; transition: all 100ms ease-out; } &__frame { position: absolute; - width: 44px; - height: 44px; - top: -2px; - left: -2px; background-image: url('../images/icons/large/default.png'); background-repeat: no-repeat; background-size: contain; diff --git a/src/components/Icon.tsx b/src/components/Icon.tsx index 445a3e4..bd6bdaa 100644 --- a/src/components/Icon.tsx +++ b/src/components/Icon.tsx @@ -11,7 +11,7 @@ interface Props { export const Icon: FC = ({ name, size = 'medium', golden = false, children }) => { const [hasLoadedImage, setHasLoadedImage] = useState(false) - const bgSize = size === 'medium' ? 'large' : 'medium' + const bgSize = size !== 'small' ? 'large' : 'medium' const url = `https://wow.zamimg.com/images/wow/icons/${bgSize}/${name}.jpg` useEffect(() => { diff --git a/src/components/IndexRoute.tsx b/src/components/IndexRoute.tsx index da63762..8c5002f 100644 --- a/src/components/IndexRoute.tsx +++ b/src/components/IndexRoute.tsx @@ -33,7 +33,7 @@ export class IndexRoute extends React.PureComponent { return (
- + {selectedClass && +} + +const iconNames = [ + 'foo', + 'spell_holy_prayerofhealing', + 'ability_sap', + 'class_shaman', + 'inv_ammo_firetar', + 'spell_shadow_requiem', +] + +export class PlaygroundRoute extends React.PureComponent { + static whyDidYouRender = true + + render() { + const { match, history } = this.props + + + + return ( +
+

Class Picker

+ + +

Icons

+ +

Small Icons

+
+ {iconNames.map((n) => )} +
+ +

Medium Icons

+
+ {iconNames.map((n) => )} +
+ +

Large Icons

+
+ {iconNames.map((n) => )} +
+ +

Tooltip

+ + + + I can use normal HTML in here +
+ And even link to exciting places! +
+ + + + + + +
+ ) + } +} \ No newline at end of file diff --git a/src/components/Tooltip.scss b/src/components/Tooltip.scss index e69de29..ed15b66 100644 --- a/src/components/Tooltip.scss +++ b/src/components/Tooltip.scss @@ -0,0 +1,69 @@ +@mixin tooltip-base { + font-size: 12px; + font-family: Verdana, Geneva, Tahoma, sans-serif; + line-height: 1.4; + + &__inner { + display: inline-block; + flex-direction: column; + align-items: flex-start; + } + + &__top { + display: flex; + + &:after { + content: ''; + padding: 3px; + background: url('../images/tooltip-background.png'); + background-position: top right; + } + } + + &__body { + min-height: 2px; + padding: 8px 4px 2px 10px; + background: url('../images/tooltip-background.png'); + background-position: top left; + } + + &__footer { + display: flex; + width: 100%; + + &:before { + content: ''; + flex: 1; + padding: 3px; + background: url('../images/tooltip-background.png'); + background-position: bottom left; + } + + &:after { + content: ''; + padding: 3px; + background: url('../images/tooltip-background.png'); + background-position: bottom right; + } + } +} + +.tooltip { + @include tooltip-base; + + &--inline { + display: inline-block; + } + + &--fixed { + width: 320px; + + .tooltip__inner { + width: 100%; + } + + .tooltip__body { + flex: 1; + } + } +} \ No newline at end of file diff --git a/src/components/Tooltip.tsx b/src/components/Tooltip.tsx index 8a7d81a..0a55789 100644 --- a/src/components/Tooltip.tsx +++ b/src/components/Tooltip.tsx @@ -1,11 +1,39 @@ import './Tooltip.scss' import React, { FC } from 'react' +import classNames from 'classnames' interface Props { + title?: string + /** Override width of tooltip. Needs `fixed` to be true to have effect. */ + width?: string + /** Fixed width */ + fixed?: boolean + /** Display tooltip inline */ + inline?: boolean } export const Tooltip: FC = (props) => { - return
- + const { title, children } = props + + const cn = classNames('tooltip', { + 'tooltip--fixed': props.fixed, + 'tooltip--inline': props.inline, + }) + + const style = { + width: props.width + } + + return
+
+
+
+ {title} + {children} +
+
+ +
+
} \ No newline at end of file diff --git a/src/sass/_config.scss b/src/sass/_config.scss index e1fb684..0eb1beb 100644 --- a/src/sass/_config.scss +++ b/src/sass/_config.scss @@ -11,4 +11,15 @@ $color-yellow: #ffd100; $color-green: #1eff00; $color-dark-green: #40bf40; $color-subtle: #9d9d9d; -$color-icon-overlay: #6396d6; \ No newline at end of file +$color-icon-overlay: #6396d6; + +// Class colours +$color-warrior: #c69b6d; +$color-paladin: #f48cba; +$color-hunter: #aad372; +$color-rogue: #fff468; +$color-priest: #fff; +$color-shaman: #2359ff; +$color-mage: #68ccef; +$color-warlock: #9382c9; +$color-druid: #ff7c0a;