grafana/public/app/features/browse-dashboards/components/Indent.tsx
Josh Hunt 9b15c79e19
NestedFolders: Virtual tree view (#66102)
* poc for virtual tree

* remove my silly debug stuff

* wip

* style table

* improve styles

* fix

* start to split tree into seperate component

* cleanup unused function

* split into more components

* more better

* secondary color type column

* simple tests for DashboardsTree

* restore styles from dodgy rebase

* remove my weirdo text component thing
2023-04-17 11:08:24 +01:00

21 lines
595 B
TypeScript

import React from 'react';
import { useTheme2 } from '@grafana/ui';
import { INDENT_AMOUNT_CSS_VAR } from '../types';
interface IndentProps {
children?: React.ReactNode;
level: number;
}
export function Indent({ children, level }: IndentProps) {
const theme = useTheme2();
// DashboardsTree responsively sets the value of INDENT_AMOUNT_CSS_VAR
// but we also have a fallback just in case it's not set for some reason...
const space = `var(${INDENT_AMOUNT_CSS_VAR}, ${theme.spacing(2)})`;
return <span style={{ paddingLeft: `calc(${space} * ${level})` }}>{children}</span>;
}