Skip to content

Instantly share code, notes, and snippets.

@RSpace
Last active January 3, 2016 10:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RSpace/23a10dcd02145763d58e to your computer and use it in GitHub Desktop.
Save RSpace/23a10dcd02145763d58e to your computer and use it in GitHub Desktop.
MeetupVR - Member.js
export default class Member extends Component {
render () {
const { id, name, photoUrl } = this.props
if (this.props.vrMode) {
const { width, height, depth } = this.props
const { x, y, z } = this.props.position
const color = `#${TYPE_TO_COLOR_MAP[this.props.type || '']}`
return (
<Entity geometry={{'primitive': 'box', width: width, height: height, depth: depth}}
material={{src: `url(${photoUrl})`, color}}
position={`${x} ${y} ${z}`}
onClick={() => {this.props.onClick(id) }} />
)
} else {
var memberClass = classNames({
'member-component': true,
'member-component__hipster': this.props.type === 'hipster',
'member-component__hacker': this.props.type === 'hacker',
'member-component__hustler': this.props.type === 'hustler'
})
return (
<div className={memberClass} onClick={() => {this.props.onClick(id) }} title={name}>
<img src={photoUrl} width="100" height="100" />
</div>
)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment