mirror of
https://github.com/roleypoly/roleypoly-v1.git
synced 2025-04-25 12:19:10 +00:00
UI: add real proptypes for immutable things
This commit is contained in:
parent
a8196de3c7
commit
6cc827d258
4 changed files with 19 additions and 6 deletions
|
@ -1,11 +1,17 @@
|
||||||
import React, { Component } from 'react'
|
import React, { Component } from 'react'
|
||||||
import Radium from 'radium'
|
import PropTypes from 'prop-types'
|
||||||
import Color from 'color'
|
import Color from 'color'
|
||||||
import './Role.sass'
|
import './Role.sass'
|
||||||
|
|
||||||
const whiteColor = Color('#efefef')
|
const whiteColor = Color('#efefef')
|
||||||
|
|
||||||
class Role extends Component {
|
class Role extends Component {
|
||||||
|
static propTypes = {
|
||||||
|
role: PropTypes.object.isRequired,
|
||||||
|
onToggle: PropTypes.func,
|
||||||
|
type: PropTypes.string
|
||||||
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { role } = this.props
|
const { role } = this.props
|
||||||
let color = Color(role.color)
|
let color = Color(role.color)
|
||||||
|
@ -34,4 +40,4 @@ class Role extends Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Radium(Role)
|
export default Role
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import React, { Component, Fragment } from 'react'
|
import React, { Component, Fragment } from 'react'
|
||||||
|
import ImmutablePropTypes from 'react-immutable-proptypes'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import ServerCard from './ServerCard'
|
import ServerCard from './ServerCard'
|
||||||
import UserCard from './UserCard'
|
import UserCard from './UserCard'
|
||||||
|
@ -6,8 +7,8 @@ import UserCard from './UserCard'
|
||||||
class ServersNavigation extends Component {
|
class ServersNavigation extends Component {
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
user: PropTypes.object.isRequired,
|
user: ImmutablePropTypes.map.isRequired,
|
||||||
servers: PropTypes.arrayOf(PropTypes.object).isRequired,
|
servers: ImmutablePropTypes.setOf(ImmutablePropTypes.map).isRequired,
|
||||||
className: PropTypes.string
|
className: PropTypes.string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,15 @@
|
||||||
import React, { Component } from 'react'
|
import React, { Component } from 'react'
|
||||||
|
import ImmutablePropTypes from 'react-immutable-proptypes'
|
||||||
import { NavLink } from 'react-router-dom'
|
import { NavLink } from 'react-router-dom'
|
||||||
import Radium from 'radium'
|
import Radium from 'radium'
|
||||||
import './ServerCard.sass'
|
import './ServerCard.sass'
|
||||||
|
|
||||||
class ServerCard extends Component {
|
class ServerCard extends Component {
|
||||||
|
static propTypes = {
|
||||||
|
user: ImmutablePropTypes.map.isRequired,
|
||||||
|
server: ImmutablePropTypes.map.isRequired,
|
||||||
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { server, user } = this.props
|
const { server, user } = this.props
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import React, { Component } from 'react'
|
import React, { Component } from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import ImmutablePropTypes from 'react-immutable-proptypes'
|
||||||
import { NavLink } from 'react-router-dom'
|
import { NavLink } from 'react-router-dom'
|
||||||
import './UserCard.sass'
|
import './UserCard.sass'
|
||||||
|
|
||||||
class UserCard extends Component {
|
class UserCard extends Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
user: PropTypes.object.isRequired
|
user: ImmutablePropTypes.map
|
||||||
}
|
}
|
||||||
|
|
||||||
get avatar () {
|
get avatar () {
|
||||||
|
|
Loading…
Add table
Reference in a new issue