/**
* The shell every card on the page shares: tabs (or the title) top left, the
* metric top right, the rows, and a quiet centred Details at the foot. The
* cards sit two to a row at equal height, so the foot is pushed to the bottom.
*/
import { __ } from '@wordpress/i18n';
import { useUi } from './ui-context';
export default function CardShell( { title, tabs, end, onDetails, children } ) {
const { Button, Card, FilterTabs } = useUi();
return (
{ tabs && tabs.items.length > 1 ? (
) : (
{ title }
) }
{ end &&
{ end }
}
{ children }
{ onDetails && (
) }
);
}
/** The metric switch top right: Visitors ⇄ Page views, shared by the four breakdown cards. */
export function MetricSwitch( { metric, onChange } ) {
const { Button, icons } = useUi();
const label = 'pageviews' === metric ? __( 'Page views', 'saddle-analytics' ) : __( 'Visitors', 'saddle-analytics' );
return (
);
}
/** A static metric name top right, for cards with one measure. */
export function MetricName( { children } ) {
return { children };
}