diff --git a/stories/Box.stories.tsx b/stories/Box.stories.tsx
index 750e7a9654..81b5884729 100644
--- a/stories/Box.stories.tsx
+++ b/stories/Box.stories.tsx
@@ -1,6 +1,6 @@
/* eslint-disable react/jsx-props-no-spreading */
import React from 'react';
-import Box from '@ui/Box';
+import Box, { CollapseBox } from '@ui/Box';
import Button from '@ui/Button';
import { ComponentMeta } from '@storybook/react';
import '../webapp/sass/profile.scss';
@@ -24,3 +24,15 @@ export const BoxWithButtonNoPadding = () => (
Hello, world
);
+
+export const CollapseBoxWithContent = () => (
+
+ Hello, world
+
+);
+
+export const CollapseBoxWhenTitleIsEmptyString = () => (
+
+ Hello, world
+
+);
diff --git a/webapp/javascript/pages/TagExplorerView.module.scss b/webapp/javascript/pages/TagExplorerView.module.scss
index 9ff7d3531e..8599cd9c76 100644
--- a/webapp/javascript/pages/TagExplorerView.module.scss
+++ b/webapp/javascript/pages/TagExplorerView.module.scss
@@ -23,8 +23,8 @@
.tableDescription {
display: flex;
- justify-content: space-between;
- margin: 0 10px 10px;
+ justify-content: flex-end;
+ margin: 0 0 10px 10px;
}
.title {
diff --git a/webapp/javascript/pages/TagExplorerView.tsx b/webapp/javascript/pages/TagExplorerView.tsx
index 7793936c8c..3572eb34ce 100644
--- a/webapp/javascript/pages/TagExplorerView.tsx
+++ b/webapp/javascript/pages/TagExplorerView.tsx
@@ -5,7 +5,7 @@ import type { ClickEvent } from '@szhsin/react-menu';
import Color from 'color';
import type { Profile } from '@pyroscope/models/src';
-import Box from '@webapp/ui/Box';
+import Box, { CollapseBox } from '@webapp/ui/Box';
import Toolbar from '@webapp/components/Toolbar';
import ExportData from '@webapp/components/ExportData';
import TimelineChartWrapper, {
@@ -238,7 +238,11 @@ function TagExplorerView() {
)}
-
+ `${a} Descriptive Statistics`)
+ .unwrapOr('Descriptive Statistics')}`}
+ >
-
+
{type === 'loading' ? (
@@ -377,7 +381,6 @@ function Table({
return (
<>
-
{appName} Descriptive Statistics
);
}
+
+export interface CollapseBoxProps {
+ /** must be non empty */
+ title: string;
+ children: React.ReactNode;
+}
+
+export function CollapseBox({ title, children }: CollapseBoxProps) {
+ const [collapsed, toggleCollapse] = useState(false);
+
+ return (
+
+
toggleCollapse((c) => !c)}
+ className={styles.collapseTitle}
+ aria-hidden
+ >
+
{title}
+
+
+
+ {children}
+
+
+ );
+}