-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSpell.jsx
More file actions
51 lines (42 loc) · 1.34 KB
/
Spell.jsx
File metadata and controls
51 lines (42 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import React from "react";
import LazyLoad from 'react-lazyload';
import DSALink from '../controls/DSALink';
import DSAInfoBox from '../controls/DSAInfoBox';
import FavoriteStar from '../controls/DSAFavoriteStar';
import SpellProperties from './SpellProperties';
import SpellExtensions from "./SpellExtensions";
import {DSASpellClasses} from "../data/DSASpellClasses";
const SpellMetaInfo = ({spellclass}) => {
const link = DSASpellClasses.link + DSASpellClasses.SpellClasses[spellclass].link;
let tooltip = spellclass + " im Regelwiki";
return (
<DSALink tooltip={tooltip} href={link}>{spellclass}</DSALink>
);
}
const SpellTitle = ({favorites, name, onUserInput}) => {
const fav = (favorites.indexOf(name) >= 0);
const handleFavClick = () => {
onUserInput(name);
}
return <span>
{name}
<FavoriteStar fav={fav} onClick={handleFavClick} />
</span>;
}
class Spell extends React.Component {
render() {
const title = <SpellTitle {...this.props}/>
return (
<LazyLoad height={200} once >
<DSAInfoBox
title={title}
text={<SpellMetaInfo spellclass={this.props.spellclass}/>}
>
<SpellProperties properties={this.props.properties} />
<SpellExtensions extensions={this.props.extensions} />
</DSAInfoBox>
</LazyLoad>
);
}
}
export default Spell