Support centered and left-justified statistic views
This commit is contained in:
parent
2fe1277cfa
commit
d14743c396
@ -7,16 +7,18 @@ interface ItemProps {
|
|||||||
prefix: JSX.Element,
|
prefix: JSX.Element,
|
||||||
color: string,
|
color: string,
|
||||||
progress?: boolean,
|
progress?: boolean,
|
||||||
|
centered: boolean,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function StatisticItem(props: ItemProps) {
|
export default function StatisticItem(props: ItemProps) {
|
||||||
const { title, value, prefix } = props;
|
const { title, value, prefix } = props;
|
||||||
const View = props.progress ? ProgressView : StatisticView;
|
const View = props.progress ? ProgressView : StatisticView;
|
||||||
|
const style = props.centered ? {display: 'flex', alignItems: 'center', justifyContent: 'center'} : {};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Col span={8}>
|
<Col span={8}>
|
||||||
<Card>
|
<Card>
|
||||||
<div style={{display: 'flex', alignItems: 'center', justifyContent: 'center'}}>
|
<div style={style}>
|
||||||
<View {...props} />
|
<View {...props} />
|
||||||
</div>
|
</div>
|
||||||
</Card>
|
</Card>
|
||||||
|
@ -81,6 +81,7 @@ const series = [
|
|||||||
prefix={<LaptopOutlined style={{color: series[0].color }}/>}
|
prefix={<LaptopOutlined style={{color: series[0].color }}/>}
|
||||||
color={series[0].color}
|
color={series[0].color}
|
||||||
progress
|
progress
|
||||||
|
centered
|
||||||
/>
|
/>
|
||||||
<StatisticItem
|
<StatisticItem
|
||||||
title={series[1].name}
|
title={series[1].name}
|
||||||
@ -88,6 +89,7 @@ const series = [
|
|||||||
prefix={<BulbOutlined style={{color: series[1].color }} />}
|
prefix={<BulbOutlined style={{color: series[1].color }} />}
|
||||||
color={series[1].color}
|
color={series[1].color}
|
||||||
progress
|
progress
|
||||||
|
centered
|
||||||
/>
|
/>
|
||||||
<StatisticItem
|
<StatisticItem
|
||||||
title={series[2].name}
|
title={series[2].name}
|
||||||
@ -95,6 +97,7 @@ const series = [
|
|||||||
prefix={<SaveOutlined style={{color: series[2].color }} />}
|
prefix={<SaveOutlined style={{color: series[2].color }} />}
|
||||||
color={series[2].color}
|
color={series[2].color}
|
||||||
progress
|
progress
|
||||||
|
centered
|
||||||
/>
|
/>
|
||||||
</Row>
|
</Row>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user