-
Notifications
You must be signed in to change notification settings - Fork 841
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* WIP add euiStat * feedback and more docs * address PR feedback
- Loading branch information
Ryan Keairns
authored
Aug 29, 2018
1 parent
39c94c1
commit e1184d8
Showing
17 changed files
with
596 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from 'react'; | ||
|
||
import { | ||
EuiStat, | ||
EuiFlexItem, | ||
EuiFlexGroup, | ||
} from '../../../../src/components'; | ||
|
||
export default () => ( | ||
<div> | ||
<EuiFlexGroup> | ||
<EuiFlexItem> | ||
<EuiStat | ||
title="7,600 mm" | ||
description="Total People" | ||
/> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
</div> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React from 'react'; | ||
|
||
import { | ||
EuiStat, | ||
EuiFlexItem, | ||
EuiFlexGroup, | ||
} from '../../../../src/components'; | ||
|
||
export default () => ( | ||
<div> | ||
<EuiFlexGroup> | ||
<EuiFlexItem> | ||
<EuiStat | ||
title="$ 1,000.00" | ||
description="Left align" | ||
textAlign="left" | ||
/> | ||
</EuiFlexItem> | ||
<EuiFlexItem> | ||
<EuiStat | ||
title="99.9999" | ||
description="Center align" | ||
textAlign="center" | ||
/> | ||
</EuiFlexItem> | ||
<EuiFlexItem> | ||
<EuiStat | ||
title="1,000.00 €" | ||
description="Right align" | ||
textAlign="right" | ||
/> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
</div> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import React from 'react'; | ||
|
||
import { | ||
EuiStat, | ||
EuiFlexItem, | ||
EuiFlexGroup, | ||
} from '../../../../src/components'; | ||
|
||
export default () => ( | ||
<div> | ||
<EuiFlexGroup> | ||
<EuiFlexItem> | ||
<EuiStat | ||
title="1" | ||
description="Default color" | ||
/> | ||
</EuiFlexItem> | ||
<EuiFlexItem> | ||
<EuiStat | ||
title="10" | ||
description="Subdued color" | ||
titleColor="subdued" | ||
/> | ||
</EuiFlexItem> | ||
<EuiFlexItem> | ||
<EuiStat | ||
title="100" | ||
description="Primary color" | ||
titleColor="primary" | ||
/> | ||
</EuiFlexItem> | ||
<EuiFlexItem> | ||
<EuiStat | ||
title="1,000" | ||
description="Secondary color" | ||
titleColor="secondary" | ||
/> | ||
</EuiFlexItem> | ||
<EuiFlexItem> | ||
<EuiStat | ||
title="10,000" | ||
description="Danger color" | ||
titleColor="danger" | ||
/> | ||
</EuiFlexItem> | ||
<EuiFlexItem> | ||
<EuiStat | ||
title="100,000" | ||
description="Accent color" | ||
titleColor="accent" | ||
/> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
</div> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import React from 'react'; | ||
|
||
import { | ||
EuiStat, | ||
EuiFlexItem, | ||
EuiFlexGroup, | ||
EuiPanel, | ||
EuiIcon, | ||
} from '../../../../src/components'; | ||
|
||
export default () => ( | ||
<div> | ||
<EuiFlexGroup> | ||
<EuiFlexItem> | ||
<EuiPanel> | ||
<EuiStat | ||
title="8,888" | ||
description="Total widgets" | ||
textAlign="right" | ||
> | ||
<EuiIcon type="empty" /> | ||
</EuiStat> | ||
</EuiPanel> | ||
</EuiFlexItem> | ||
<EuiFlexItem> | ||
<EuiPanel> | ||
<EuiStat | ||
title="2,000" | ||
description="Pending widgets" | ||
titleColor="accent" | ||
textAlign="right" | ||
> | ||
<EuiIcon type="clock" color="accent" /> | ||
</EuiStat> | ||
</EuiPanel> | ||
</EuiFlexItem> | ||
<EuiFlexItem> | ||
<EuiPanel> | ||
<EuiStat | ||
title="6,800" | ||
description="Success widgets" | ||
titleColor="secondary" | ||
textAlign="right" | ||
> | ||
<EuiIcon type="check" color="secondary" /> | ||
</EuiStat> | ||
</EuiPanel> | ||
</EuiFlexItem> | ||
<EuiFlexItem> | ||
<EuiPanel> | ||
<EuiStat | ||
title="88" | ||
description="Error widgets" | ||
titleColor="danger" | ||
textAlign="right" | ||
> | ||
<EuiIcon type="alert" color="danger" /> | ||
</EuiStat> | ||
</EuiPanel> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
</div> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
import React from 'react'; | ||
|
||
import { renderToHtml } from '../../services'; | ||
|
||
import { | ||
GuideSectionTypes, | ||
} from '../../components'; | ||
|
||
import { | ||
EuiCode, | ||
EuiStat, | ||
} from '../../../../src/components'; | ||
|
||
import Stat from './stat'; | ||
const statSource = require('!!raw-loader!./stat'); | ||
const statHtml = renderToHtml(Stat); | ||
|
||
import StatColors from './stat_colors'; | ||
const statColorsSource = require('!!raw-loader!./stat_colors'); | ||
const statColorsHtml = renderToHtml(StatColors); | ||
|
||
import StatAlign from './stat_align'; | ||
const statAlignSource = require('!!raw-loader!./stat_align'); | ||
const statAlignHtml = renderToHtml(StatAlign); | ||
|
||
import StatSize from './stat_size'; | ||
const statSizeSource = require('!!raw-loader!./stat_size'); | ||
const statSizeHtml = renderToHtml(StatSize); | ||
|
||
import StatOrder from './stat_order'; | ||
const statOrderSource = require('!!raw-loader!./stat_order'); | ||
const statOrderHtml = renderToHtml(StatOrder); | ||
|
||
import StatCombos from './stat_combos'; | ||
const statCombosSource = require('!!raw-loader!./stat_combos'); | ||
const statCombosHtml = renderToHtml(StatCombos); | ||
|
||
export const StatExample = { | ||
title: 'Stat', | ||
sections: [{ | ||
source: [{ | ||
type: GuideSectionTypes.JS, | ||
code: statSource, | ||
}, { | ||
type: GuideSectionTypes.HTML, | ||
code: statHtml, | ||
}], | ||
text: ( | ||
<p> | ||
<EuiCode>EuiStat</EuiCode> can be used to display prominent text or number values. It consists of <EuiCode>title</EuiCode> | ||
and <EuiCode>description</EuiCode> elements with several visual styling properties (examples below). | ||
</p> | ||
), | ||
props: { EuiStat }, | ||
demo: <Stat />, | ||
}, { | ||
title: 'Applying color', | ||
source: [{ | ||
type: GuideSectionTypes.JS, | ||
code: statColorsSource, | ||
}, { | ||
type: GuideSectionTypes.HTML, | ||
code: statColorsHtml, | ||
}], | ||
text: ( | ||
<p> | ||
<EuiCode>title</EuiCode> can be altered using the color property. By default, it will appear in <EuiCode>full</EuiCode> color. | ||
For proper color contrast, only a limited set of EUI colors are offered. See the Props tab above for a list of available colors. | ||
</p> | ||
), | ||
demo: <StatColors />, | ||
}, { | ||
title: 'Text alignment', | ||
source: [{ | ||
type: GuideSectionTypes.JS, | ||
code: statAlignSource, | ||
}, { | ||
type: GuideSectionTypes.HTML, | ||
code: statAlignHtml, | ||
}], | ||
text: ( | ||
<p> | ||
<EuiCode>EuiStat</EuiCode> also offers alignment options. By default, text will be left aligned. | ||
</p> | ||
), | ||
demo: <StatAlign />, | ||
}, { | ||
title: 'Title size', | ||
source: [{ | ||
type: GuideSectionTypes.JS, | ||
code: statSizeSource, | ||
}, { | ||
type: GuideSectionTypes.HTML, | ||
code: statSizeHtml, | ||
}], | ||
text: ( | ||
<p> | ||
<EuiCode>title</EuiCode> uses the <EuiCode>EuiTitle</EuiCode> component and thus its sizing properites. | ||
Although all <EuiCode>EuiTitle</EuiCode> sizes are available, suggested sizes include <EuiCode>`l`, `m`, and `s`</EuiCode>. | ||
By default, the size is set to Large (<EuiCode>`l`</EuiCode>). The <EuiCode>description</EuiCode> label cannot be re-sized via | ||
component properties. | ||
</p> | ||
), | ||
demo: <StatSize />, | ||
}, { | ||
title: 'Reverse the order', | ||
source: [{ | ||
type: GuideSectionTypes.JS, | ||
code: statOrderSource, | ||
}, { | ||
type: GuideSectionTypes.HTML, | ||
code: statOrderHtml, | ||
}], | ||
text: ( | ||
<p> | ||
You can reverse the order of the <EuiCode>description</EuiCode> and <EuiCode>title</EuiCode> text by setting | ||
the <EuiCode>reverse</EuiCode> property to true. By default, the description (label) is displayed above the title (value). | ||
</p> | ||
), | ||
demo: <StatOrder />, | ||
}, { | ||
title: 'Putting it all together', | ||
source: [{ | ||
type: GuideSectionTypes.JS, | ||
code: statCombosSource, | ||
}, { | ||
type: GuideSectionTypes.HTML, | ||
code: statCombosHtml, | ||
}], | ||
text: ( | ||
<p> | ||
Following are samples demonstrating how you might assemble and display <EuiCode>EuiStat</EuiCode> components. | ||
</p> | ||
), | ||
demo: <StatCombos />, | ||
}], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React from 'react'; | ||
|
||
import { | ||
EuiStat, | ||
EuiFlexItem, | ||
EuiFlexGroup, | ||
} from '../../../../src/components'; | ||
|
||
export default () => ( | ||
<div> | ||
<EuiFlexGroup> | ||
<EuiFlexItem> | ||
<EuiStat | ||
title="10,000" | ||
description="Description underneath" | ||
reverse | ||
/> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
</div> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React from 'react'; | ||
|
||
import { | ||
EuiStat, | ||
EuiFlexItem, | ||
EuiFlexGroup, | ||
} from '../../../../src/components'; | ||
|
||
export default () => ( | ||
<div> | ||
<EuiFlexGroup> | ||
<EuiFlexItem> | ||
<EuiStat | ||
title="1,000,000" | ||
description="Large size" | ||
titleSize="l" | ||
/> | ||
</EuiFlexItem> | ||
<EuiFlexItem> | ||
<EuiStat | ||
title="1,000,000" | ||
description="Medium size" | ||
titleSize="m" | ||
/> | ||
</EuiFlexItem> | ||
<EuiFlexItem> | ||
<EuiStat | ||
title="1,000,000" | ||
description="Small size" | ||
titleSize="s" | ||
/> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
</div> | ||
); |
Oops, something went wrong.