mirror of
https://github.com/kremalicious/umami.git
synced 2025-02-14 21:10:34 +01:00
Added toggle button to report menu.
This commit is contained in:
parent
21ff3d1280
commit
d765f5f1a0
@ -1,7 +1,38 @@
|
|||||||
.menu {
|
.menu {
|
||||||
|
position: relative;
|
||||||
width: 300px;
|
width: 300px;
|
||||||
padding-inline-end: 20px;
|
padding-inline-end: 20px;
|
||||||
border-inline-end: 1px solid var(--base300);
|
border-inline-end: 1px solid var(--base300);
|
||||||
grid-row: 2 / 3;
|
grid-row: 2 / 3;
|
||||||
grid-column: 1 / 2;
|
grid-column: 1 / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.button {
|
||||||
|
display: flex;
|
||||||
|
place-content: center;
|
||||||
|
border: 1px solid var(--base400);
|
||||||
|
border-right: 0;
|
||||||
|
width: 30px;
|
||||||
|
padding: 5px;
|
||||||
|
right: 0;
|
||||||
|
position: absolute;
|
||||||
|
cursor: pointer;
|
||||||
|
z-index: 1;
|
||||||
|
border-radius: 4px 0 0 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button:hover {
|
||||||
|
background: var(--base75);
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu.collapsed {
|
||||||
|
width: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu.collapsed .button {
|
||||||
|
left: 1px;
|
||||||
|
border-left: 0;
|
||||||
|
border-right: 1px solid var(--base300);
|
||||||
|
border-radius: 0 4px 4px 0;
|
||||||
|
}
|
||||||
|
@ -1,15 +1,27 @@
|
|||||||
import styles from './ReportMenu.module.css';
|
import { useContext, useState } from 'react';
|
||||||
import { useContext } from 'react';
|
|
||||||
import { ReportContext } from './Report';
|
import { ReportContext } from './Report';
|
||||||
|
import styles from './ReportMenu.module.css';
|
||||||
|
import { Icon, Icons } from 'react-basics';
|
||||||
|
import classNames from 'classnames';
|
||||||
|
|
||||||
export function ReportMenu({ children }) {
|
export function ReportMenu({ children }) {
|
||||||
|
const [collapsed, setCollapsed] = useState(true);
|
||||||
const { report } = useContext(ReportContext);
|
const { report } = useContext(ReportContext);
|
||||||
|
|
||||||
if (!report) {
|
if (!report) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return <div className={styles.menu}>{children}</div>;
|
return (
|
||||||
|
<div className={classNames(styles.menu, collapsed && styles.collapsed)}>
|
||||||
|
<div className={styles.button} onClick={() => setCollapsed(!collapsed)}>
|
||||||
|
<Icon rotate={collapsed ? -90 : 90}>
|
||||||
|
<Icons.ChevronDown />
|
||||||
|
</Icon>
|
||||||
|
</div>
|
||||||
|
{!collapsed && children}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ReportMenu;
|
export default ReportMenu;
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
gap: 20px;
|
gap: 20px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
height: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.visitors {
|
.visitors {
|
||||||
@ -41,8 +42,8 @@
|
|||||||
|
|
||||||
.dropoff {
|
.dropoff {
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: var(--base800);
|
color: var(--blue800);
|
||||||
background: var(--base200);
|
background: var(--blue100);
|
||||||
padding: 4px 8px;
|
padding: 4px 8px;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user