Passed
Push — master ( 054653...03cb87 )
by Michael
02:05 queued 11s
created

Variant.render   A

Complexity

Conditions 1

Size

Total Lines 3
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
import React, { Component } from 'react'
2
import PropTypes from 'prop-types'
3
import getWeight from './utils/getWeight'
4
5
6
export default class Variant extends Component {
7
  static propTypes = {
8
    name: PropTypes.string.isRequired,
9
    weight: PropTypes.oneOfType([
10
      PropTypes.string,
11
      PropTypes.number,
12
    ]),
13
  }
14
15
  static isVariant = true
16
17
  getName() {
18
    return this.props.name
19
  }
20
21
  getWeight() {
22
    return getWeight(this.props.weight)
23
  }
24
25
  render() {
26
    return this.props.children
27
  }
28
}
29