mirror of
https://github.com/grafana/grafana.git
synced 2025-02-16 18:34:52 -06:00
* 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
21 lines
595 B
TypeScript
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>;
|
|
}
|