Skip to content

Commit ccaf3d9

Browse files
adding label to joystick
1 parent b7d1831 commit ccaf3d9

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

demo.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@
5050
################ Set up light layout ################
5151
controls = html.Div([
5252
Joystick(
53-
id='demojoystick'
53+
id='demojoystick',
54+
label='Joystick',
5455
),
5556
Knob(
5657
id='demoKnob',
@@ -239,6 +240,10 @@
239240

240241
################ Set up dark layout ################
241242
dark_controls = html.Div([
243+
Joystick(
244+
id='dark-demojoystick',
245+
label='Joystick',
246+
),
242247
Knob(
243248
id='dark-demoKnob',
244249
label='Knob',

src/components/Joystick.react.js

+11-8
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
33
import { withTheme } from 'styled-components';
44
import joystick from 'nipplejs';
55
import { light } from '../styled/constants';
6+
import LabelContainer from '../styled/shared/LabelContainer.styled';
67

78
/**
89
* A joystick.
@@ -51,14 +52,16 @@ class Joystick extends Component {
5152

5253
return (
5354
<div id={id} className={className} style={style}>
54-
<div
55-
ref={ref => (this.zoneRef = ref)}
56-
style={{
57-
position: 'relative',
58-
width: size + 'px',
59-
height: size + 'px'
60-
}}
61-
/>
55+
<LabelContainer {...this.props}>
56+
<div
57+
ref={ref => (this.zoneRef = ref)}
58+
style={{
59+
position: 'relative',
60+
width: size + 'px',
61+
height: size + 'px'
62+
}}
63+
/>
64+
</LabelContainer>
6265
</div>
6366
);
6467
}

0 commit comments

Comments
 (0)