mirror of
https://github.com/umami-software/umami.git
synced 2026-02-07 22:27:16 +01:00
Toggle formatting on click. Renamed charts folder to metrics.
This commit is contained in:
parent
d9f3c385fb
commit
e75593443a
19 changed files with 33 additions and 28 deletions
|
|
@ -1,31 +0,0 @@
|
|||
import React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import Button from '../common/Button';
|
||||
import { getDateRange } from 'lib/date';
|
||||
import styles from './QuickButtons.module.css';
|
||||
|
||||
const options = {
|
||||
'24hour': '24h',
|
||||
'7day': '7d',
|
||||
'30day': '30d',
|
||||
};
|
||||
|
||||
export default function QuickButtons({ value, onChange }) {
|
||||
function handleClick(value) {
|
||||
onChange(getDateRange(value));
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={styles.buttons}>
|
||||
{Object.keys(options).map(key => (
|
||||
<Button
|
||||
key={key}
|
||||
className={classNames(styles.button, { [styles.active]: value === key })}
|
||||
onClick={() => handleClick(key)}
|
||||
>
|
||||
{options[key]}
|
||||
</Button>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue