Completed
Push — master ( 84f701...51cc74 )
by Michael
12s queued 10s
created

Variant   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 18
dl 0
loc 23
rs 10
c 0
b 0
f 0
wmc 3

3 Functions

Rating   Name   Duplication   Size   Complexity  
A render 0 3 1
A getName 0 3 1
A getWeight 0 3 1
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