-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Copy pathCharacterEditor.js
93 lines (87 loc) · 2.84 KB
/
CharacterEditor.js
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import React from 'react';
import { defaultSkinColor, defaultClothesColor } from '../../constants';
import Character from '../Character';
import MaxWidthWrapper from '../MaxWidthWrapper';
import ControlPane from '../ControlPane';
import {
bodyOptions,
headOptions,
faceOptions,
accessoryOptions,
skinColorOptions,
clothesColorOptions,
} from './CharacterEditor.helpers';
import styles from './CharacterEditor.module.css';
function App() {
const [body, setBody] = React.useState(0);
const [head, setHead] = React.useState(0);
const [face, setFace] = React.useState(0);
const [accessory, setAccessory] = React.useState(0);
const [skinColor, setSkinColor] = React.useState(defaultSkinColor);
const [clothesColor, setClothesColor] = React.useState(defaultClothesColor);
return (
<main className={styles.characterEditor}>
<div class={styles.perspective}></div>
<MaxWidthWrapper className={styles.maxWidthWrapper}>
<header className={styles.header}>
<h1 className={styles.title}>Create your Character</h1>
<p className={styles.description}>
Customize your character's look and style using the controls below.
What sort of adventure will you embark on?{' '}
</p>
</header>
<div>
<div className={styles.controlColumn}>
<ControlPane
title="Bodies"
options={bodyOptions}
currentOption={body}
handleSelectOption={setBody}
/>
<ControlPane
title="Heads"
options={headOptions}
currentOption={head}
handleSelectOption={setHead}
/>
<ControlPane
title="Faces"
options={faceOptions}
currentOption={face}
handleSelectOption={setFace}
/>
<ControlPane
title="Accessories"
options={accessoryOptions}
currentOption={accessory}
handleSelectOption={setAccessory}
/>
<ControlPane
title="Skin Color"
options={skinColorOptions}
currentOption={skinColor}
handleSelectOption={setSkinColor}
/>
<ControlPane
title="Clothing Color"
options={clothesColorOptions}
currentOption={clothesColor}
handleSelectOption={setClothesColor}
/>
</div>
<div className={styles.characterWrapper}>
<Character
body={body}
head={head}
face={face}
accessory={accessory}
skinColor={skinColor}
clothesColor={clothesColor}
/>
</div>
</div>
</MaxWidthWrapper>
</main>
);
}
export default App;