Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Statistic to v1 API #334

Merged
merged 35 commits into from
Jul 18, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
95cfe48
(feat) Rail #181
Jul 12, 2016
d2cfef8
(feat) Rail #181
Jul 12, 2016
97aac53
(feat) Rail docs #181
Jul 14, 2016
d9c324b
(fix) Sort Rail props #181
Jul 14, 2016
8f7c2e5
Merge branch 'master' of https://github.com/TechnologyAdvice/stardust…
Jul 14, 2016
7db8305
(fix) Rail review fixes #181
Jul 14, 2016
bd296b5
(fix) Rail review fixes #181
layershifter Jul 14, 2016
c3682a0
(fix) Rail review fixes #181
layershifter Jul 14, 2016
d74e4f6
(fix) Rail sizes #181
layershifter Jul 14, 2016
3127c4a
(fix) Rail sizes in docs #181
layershifter Jul 14, 2016
beb89fa
(fix) Statistic
Jul 15, 2016
67505e3
(feat) Statistic Item
Jul 15, 2016
ac8560c
(feat) Statistic Label and Value
Jul 15, 2016
6d0aeec
(feat) Statistic Group
Jul 15, 2016
3ab3808
(fix) Statistic fix sizes
Jul 15, 2016
5a66ab2
Merge branch 'fix/statistic' of https://github.com/layershifter/stard…
layershifter Jul 17, 2016
752fb69
(fix) Statistic functionality
layershifter Jul 17, 2016
31af031
(fix) Statistic docs
layershifter Jul 17, 2016
a6feb32
(fix) Statistic lint fixes
layershifter Jul 17, 2016
0bc7db9
(fix) Statistic tests
layershifter Jul 17, 2016
0d1da2f
Merge branch 'master' of https://github.com/TechnologyAdvice/stardust…
layershifter Jul 17, 2016
cc035fc
(Statistic) Remove shorthands
layershifter Jul 17, 2016
c7fbb20
(utils) Update numberToWord
layershifter Jul 17, 2016
5f6fa79
(Statistic) Fix returned JSX
layershifter Jul 17, 2016
4de5f51
(utils) Update numberToWord, fix imports
layershifter Jul 17, 2016
3c9634b
(Statistic) Update widths usage
layershifter Jul 17, 2016
4d7a47e
(Statistic) Fix JSDoc
layershifter Jul 17, 2016
b07c88d
Merge branch 'master' of https://github.com/TechnologyAdvice/stardust…
layershifter Jul 17, 2016
277c8b0
(Statistic) Update `rest` prop
layershifter Jul 17, 2016
7ff0c77
(utils) implementsNumberToWordProp test
layershifter Jul 17, 2016
574b05c
(Statistic) Test update
layershifter Jul 17, 2016
2bbeb26
Merge branch 'master' of https://github.com/TechnologyAdvice/stardust…
layershifter Jul 17, 2016
6e851ff
Merge branch 'master' of https://github.com/TechnologyAdvice/stardust…
Jul 18, 2016
48ac26c
fix(Statistic) Fix example
Jul 18, 2016
c9cc2f2
Merge branch 'master' of https://github.com/TechnologyAdvice/stardust…
Jul 18, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions docs/app/Examples/views/Statistic/Content/StatisticLabelExample.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react'
import { Statistic } from 'stardust'

const { Label, Value } = Statistic

const StatisticLabelExample = () => (
<div>
<Statistic>
<Value>2,204</Value>
<Label>Views</Label>
</Statistic>

<Statistic value='2,204' label='Views' />
</div>
)

export default StatisticLabelExample
42 changes: 42 additions & 0 deletions docs/app/Examples/views/Statistic/Content/StatisticValueExample.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import React from 'react'
import { Icon, Image, Statistic } from 'stardust'

const { Group, Label, Value } = Statistic

// TODO: Update <Icon> usage after <Icon> will be updated to v1 API
// TODO: Update <Image> usage after <Image> will be updated to v1 API

const StatisticValueExample = () => (
<Group>
<Statistic>
<Value>22</Value>
<Label>Saves</Label>
</Statistic>

<Statistic>
<Value text>
Three<br />
Thousand
</Value>
<Label>Signups</Label>
</Statistic>

<Statistic>
<Value>
<Icon className='plane' />
5
</Value>
<Label>Flights</Label>
</Statistic>

<Statistic>
<Value>
<Image src='http://semantic-ui.com/images/avatar/small/joe.jpg' className='circular inline' />
42
</Value>
<Label>Team Members</Label>
</Statistic>
</Group>
)

export default StatisticValueExample
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import React from 'react'
import { Icon, Image, Statistic } from 'stardust'

// TODO: Update <Icon> usage after <Icon> will be updated to v1 API
// TODO: Update <Image> usage after <Image> will be updated to v1 API

const iconValue = (<div><Icon className='plane' /> 5</div>)
const imageValue = (
<div>
<Image src='http://semantic-ui.com/images/avatar/small/joe.jpg' className='circular inline' />
42
</div>
)
const textValue = (<div>Three<br />Thousand</div>)

const items = [
{ label: 'Saves', value: 22 },
{ label: 'Signups', text: true, value: textValue },
{ label: 'Flights', value: iconValue },
{ label: 'Team Members', value: imageValue },
]

const StatisticValuePropsExample = () => (
<div>
<Statistic.Group>
<Statistic label='Saves' value='22' />
<Statistic label='Signups' text value={textValue} />
<Statistic label='Flights' value={iconValue} />
<Statistic label='Team Members' value={imageValue} />
</Statistic.Group>

<Statistic.Group items={items} />
</div>
)

export default StatisticValuePropsExample
91 changes: 79 additions & 12 deletions docs/app/Examples/views/Statistic/StatisticExamples.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,79 @@
import React, { Component } from 'react'
import StatisticTypesExamples from './Types/StatisticTypesExamples'

export default class StatisticExamples extends Component {
render() {
return (
<div>
<StatisticTypesExamples />
</div>
)
}
}
import React from 'react'
import ComponentExample from 'docs/app/Components/ComponentDoc/ComponentExample'
import ExampleSection from 'docs/app/Components/ComponentDoc/ExampleSection'

const StatisticExamples = () => (
<div>
<ExampleSection title='Types'>
<ComponentExample
title='Statistic'
description='A statistic can display a value with a label above or below it.'
examplePath='views/Statistic/Types/StatisticBottomLabelExample'
/>
<ComponentExample examplePath='views/Statistic/Types/StatisticTopLabelExample' />

<ComponentExample
title='Statistic Group'
description='A group of statistics'
examplePath='views/Statistic/Types/StatisticGroupExample'
/>
</ExampleSection>

<ExampleSection title='Content'>
<ComponentExample
title='Value'
description='A statistic can contain a numeric, icon, image, or text value.'
examplePath='views/Statistic/Content/StatisticValueExample'
/>
<ComponentExample examplePath='views/Statistic/Content/StatisticValuePropsExample' />

<ComponentExample
title='Label'
description='A statistic can contain a label to help provide context for the presented value'
examplePath='views/Statistic/Content/StatisticLabelExample'
/>
</ExampleSection>

<ExampleSection title='Variations'>
<ComponentExample
title='Horizontal Statistic'
description='A statistic can present its measurement horizontally.'
examplePath='views/Statistic/Variations/StatisticHorizontalExample'
/>
<ComponentExample examplePath='views/Statistic/Variations/StatisticGroupHorizontalExample' />

<ComponentExample
title='Colored'
description='A statistic can be formatted to be different colors'
examplePath='views/Statistic/Variations/StatisticColoredExample'
/>

<ComponentExample
title='Inverted'
description='A statistic can be formatted to fit on a dark background'
examplePath='views/Statistic/Variations/StatisticInvertedExample'
/>

<ComponentExample
title='Evenly Divided'
description='A statistic group can have its items divided evenly'
examplePath='views/Statistic/Variations/StatisticEvenlyDividedExample'
/>

<ComponentExample
title='Floated'
description='An statistic can sit to the left or right of other content'
examplePath='views/Statistic/Variations/StatisticFloatedExample'
/>

<ComponentExample
title='Size'
description='A statistic can vary in size.'
examplePath='views/Statistic/Variations/StatisticSizeExamples'
/>
<ComponentExample examplePath='views/Statistic/Variations/StatisticSizeDividedExamples' />
</ExampleSection>
</div>
)

export default StatisticExamples
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import React, { Component } from 'react'
import React from 'react'
import { Statistic } from 'stardust'

export default class StatisticBottomLabelExample extends Component {
render() {
return (
<Statistic>
<Statistic.Value>5,550</Statistic.Value>
<Statistic.Label>Downloads</Statistic.Label>
</Statistic>
)
}
}
const StatisticBottomLabelExample = () => (
<div>
<Statistic>
<Statistic.Value>5,550</Statistic.Value>
<Statistic.Label>Downloads</Statistic.Label>
</Statistic>

<Statistic value='5,500' label='Downloads' />
</div>
)

export default StatisticBottomLabelExample
49 changes: 27 additions & 22 deletions docs/app/Examples/views/Statistic/Types/StatisticGroupExample.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
import React, { Component } from 'react'
import React from 'react'
import { Statistic } from 'stardust'
const { Statistics, Label, Value } = Statistic

export default class StatisticGroupExample extends Component {
render() {
return (
<Statistics>
<Statistic>
<Value>22</Value>
<Label>Faves</Label>
</Statistic>
<Statistic>
<Value>31,200</Value>
<Label>Views</Label>
</Statistic>
<Statistic>
<Value>22</Value>
<Label>Members</Label>
</Statistic>
</Statistics>
)
}
}
const { Group, Label, Value } = Statistic
const items = [
{ label: 'Faves', value: 22 },
{ label: 'Views', value: '31,200' },
{ label: 'Members', value: 22 },
]

const StatisticGroupExample = () => (
<div>
<Group>
<Statistic>
<Value>22</Value>
<Label>Faves</Label>
</Statistic>
<Statistic>
<Value>31,200</Value>
<Label>Views</Label>
</Statistic>
<Statistic label='Members' value='22' />
</Group>

<Group items={items} />
</div>
)

export default StatisticGroupExample
22 changes: 11 additions & 11 deletions docs/app/Examples/views/Statistic/Types/StatisticTopLabelExample.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React, { Component } from 'react'
import React from 'react'
import { Statistic } from 'stardust'

export default class StatisticTopLabelExample extends Component {
render() {
return (
<Statistic>
<Statistic.Label>Views</Statistic.Label>
<Statistic.Value>40,509</Statistic.Value>
</Statistic>
)
}
}
const StatisticTopLabelExample = () => (
<div>
<Statistic>
<Statistic.Label>Views</Statistic.Label>
<Statistic.Value>40,509</Statistic.Value>
</Statistic>
</div>
)

export default StatisticTopLabelExample
25 changes: 0 additions & 25 deletions docs/app/Examples/views/Statistic/Types/StatisticTypesExamples.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from 'react'
import { Statistic } from 'stardust'

const StatisticColoredExample = () => (
<Statistic.Group>
<Statistic color='red' value='27' label='red' />
<Statistic color='orange' value='8' label='orange' />
<Statistic color='yellow' value='28' label='yellow' />
<Statistic color='olive' value='7' label='olive' />
<Statistic color='green' value='14' label='green' />
<Statistic color='teal' value='82' label='teal' />
<Statistic color='blue' value='1' label='blue' />
<Statistic color='violet' value='22' label='violet' />
<Statistic color='purple' value='23' label='purple' />
<Statistic color='pink' value='15' label='pink' />
<Statistic color='brown' value='36' label='brown' />
<Statistic color='grey' value='49' label='grey' />
</Statistic.Group>
)

export default StatisticColoredExample
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React from 'react'
import { Icon, Image, Statistic } from 'stardust'

// TODO: Update <Icon> usage after <Icon> will be updated to v1 API
// TODO: Update <Image> usage after <Image> will be updated to v1 API

const iconValue = (<div><Icon className='plane' /> 5</div>)
const imageValue = (
<div>
<Image src='http://semantic-ui.com/images/avatar/small/joe.jpg' className='circular inline' />
42
</div>
)
const textValue = (<div>Three<br />Thousand</div>)

const items = [
{ label: 'Saves', value: 22 },
{ label: 'Signups', text: true, value: textValue },
{ label: 'Flights', value: iconValue },
{ label: 'Team Members', value: imageValue },
]

const StatisticEvenlyDividedExample = () => (
<div>
<Statistic.Group widths='four' items={items} />
<Statistic.Group widths={4} items={items} />
</div>
)

export default StatisticEvenlyDividedExample
Loading