umami/components/WebsiteSummary.js
2020-07-28 19:04:45 -07:00

17 lines
446 B
JavaScript

import React from 'react';
import MetricCard from './MetricCard';
import styles from './WebsiteSummary.module.css';
function getTotal(data) {
return data.reduce((n, v) => n + v.y, 0);
}
export default function WebsiteSummary({ data }) {
return (
<div className={styles.container}>
<MetricCard label="Views" value={getTotal(data.pageviews)} />
<MetricCard label="Visitors" value={getTotal(data.uniques)} />
</div>
);
}