File tree Expand file tree Collapse file tree 7 files changed +66
-4
lines changed
docs/app/Examples/views/Statistic Expand file tree Collapse file tree 7 files changed +66
-4
lines changed Original file line number Diff line number Diff line change 1+ import React , { Component } from 'react' ;
2+ import StatisticTypesExamples from './Types/StatisticTypesExamples' ;
3+
4+ export default class StatisticExamples extends Component {
5+ render ( ) {
6+ return (
7+ < div >
8+ < StatisticTypesExamples />
9+ </ div >
10+ ) ;
11+ }
12+ }
Original file line number Diff line number Diff line change 1+ import React , { Component } from 'react' ;
2+ import { Statistic } from 'stardust' ;
3+ import _ from 'lodash' ;
4+
5+ export default class StatisticStatisticExample extends Component {
6+ render ( ) {
7+ const value = _ . random ( 0 , 12000 ) . toLocaleString ( ) ;
8+
9+ return (
10+ < Statistic value = { value } label = 'Value' />
11+ ) ;
12+ }
13+ }
Original file line number Diff line number Diff line change 1+ import React , { Component } from 'react' ;
2+ import ComponentExample from 'docs/app/Components/ComponentDoc/ComponentExample' ;
3+ import ExampleSection from 'docs/app/Components/ComponentDoc/ExampleSection' ;
4+
5+ export default class StatisticTypesExamples extends Component {
6+ render ( ) {
7+ return (
8+ < ExampleSection title = 'Types' >
9+ < ComponentExample
10+ title = 'Statistic'
11+ description = 'A statistic can display a value with a label above or below it.'
12+ examplePath = 'views/Statistic/Types/StatisticStatisticExample'
13+ />
14+ </ ExampleSection >
15+ ) ;
16+ }
17+ }
Original file line number Diff line number Diff line change @@ -38,6 +38,8 @@ import Dropdown from 'src/modules/Dropdown/Dropdown';
3838// Views
3939import Item from 'src/views/Items/Item' ;
4040import Items from 'src/views/Items/Items' ;
41+ import Statistic from 'src/views/Statistic/Statistic' ;
42+ import Statistics from 'src/views/Statistic/Statistics' ;
4143
4244export default {
4345 // Addons
@@ -80,4 +82,6 @@ export default {
8082 // Views
8183 Item,
8284 Items,
85+ Statistic,
86+ Statistics,
8387} ;
Original file line number Diff line number Diff line change @@ -6,18 +6,19 @@ import META from 'src/utils/Meta';
66export default class Statistic extends Component {
77 static propTypes = {
88 className : PropTypes . string ,
9- label : PropTypes . node ,
10- value : PropTypes . node ,
9+ label : PropTypes . node . isRequired ,
10+ value : PropTypes . node . isRequired ,
1111 } ;
1212
1313 static _meta = {
1414 library : META . library . semanticUI ,
15- name : 'Statistics ' ,
15+ name : 'Statistic ' ,
1616 type : META . type . view ,
1717 } ;
1818
1919 render ( ) {
2020 const classes = classNames (
21+ 'sd-statistic' ,
2122 'ui' ,
2223 this . props . className ,
2324 'statistic' ,
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ export default class Statistics extends Component {
1717
1818 render ( ) {
1919 const classes = classNames (
20- 'sd-statistic ' ,
20+ 'sd-statistics ' ,
2121 'ui' ,
2222 this . props . className ,
2323 'statistic'
Original file line number Diff line number Diff line change 1+ import _ from 'lodash' ;
2+ import React from 'react' ;
3+ import { Statistic } from 'stardust' ;
4+ import faker from 'faker' ;
5+
6+ describe ( 'Statistic' , ( ) => {
7+ it ( 'renders value' , ( ) => {
8+ const value = faker . hacker . phrase ( ) ;
9+ render ( < Statistic value = { value } /> ) . assertText ( value ) ;
10+ } ) ;
11+ it ( 'renders data' , ( ) => {
12+ const data = _ . random ( 0 , 10000000 ) ;
13+ render ( < Statistic data = { data } /> ) . assertText ( data ) ;
14+ } ) ;
15+ } ) ;
You can’t perform that action at this time.
0 commit comments