Fix cursor color based on theme

This commit is contained in:
Thomas Nordquist
2019-04-10 11:00:25 +02:00
parent 2590a701bb
commit 8a5bd3526d

View File

@@ -9,7 +9,7 @@ interface State {
stepSizeY: number, stepSizeY: number,
} }
class Demo extends React.Component<{}, State> { class Demo extends React.Component<{classes: any}, State> {
private timer: any private timer: any
private frameInterval = 20 private frameInterval = 20
@@ -57,22 +57,26 @@ class Demo extends React.Component<{}, State> {
if (!this.state.enabled) { if (!this.state.enabled) {
return null return null
} }
const style = { const style = {
width: '32px',
height: '32px',
position: 'fixed' as 'fixed',
zIndex: 1000000,
filter: 'invert(100%)',
left: this.state.position.x + 2, left: this.state.position.x + 2,
top: this.state.position.y + 2, top: this.state.position.y + 2,
} }
return ( return (
<img src="../cursor.png" style={style} /> <img src="../cursor.png" style={style} className={this.props.classes.cursor} />
) )
} }
} }
const style = (theme: Theme) => {} const style = (theme: Theme) => ({
cursor: {
width: '32px',
height: '32px',
position: 'fixed' as 'fixed',
zIndex: 1000000,
filter: theme.palette.type === 'light' ? undefined : 'invert(100%)',
}
})
export default withStyles(style)(Demo) export default withStyles(style)(Demo)