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

src/Variant.jsx   A

Complexity

Total Complexity 3
Complexity/F 1

Size

Lines of Code 29
Function Count 3

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 21
dl 0
loc 29
rs 10
c 0
b 0
f 0
wmc 3
mnd 0
bc 0
fnc 3
bpm 0
cpm 1
noi 0

3 Functions

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