mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 01:15:46 +08:00

* feat(grafana-ui): introduce development exports to prevent importing from grafana/ui/src * refactor(theme-generation): move theme templates into scripts so themes continue to build * refactor(frontend): replace grafana/ui paths that use nested src with /internal or /unstable * chore(betterer): update better results file * feat(grafana-ui): support enterprise, remove Text component from internal * docs(packages): update readme with exporting code conventions
27 lines
811 B
TypeScript
27 lines
811 B
TypeScript
import { css } from '@emotion/css';
|
|
import * as React from 'react';
|
|
|
|
import { GrafanaTheme2, ThemeSpacingTokens } from '@grafana/data';
|
|
import { useStyles2 } from '@grafana/ui';
|
|
import { getResponsiveStyle, ResponsiveProp } from '@grafana/ui/internal';
|
|
|
|
interface IndentProps {
|
|
children?: React.ReactNode;
|
|
level: number;
|
|
spacing: ResponsiveProp<ThemeSpacingTokens>;
|
|
}
|
|
|
|
export function Indent({ children, spacing, level }: IndentProps) {
|
|
const styles = useStyles2(getStyles, spacing, level);
|
|
|
|
return <span className={css(styles.indentor)}>{children}</span>;
|
|
}
|
|
|
|
const getStyles = (theme: GrafanaTheme2, spacing: IndentProps['spacing'], level: IndentProps['level']) => ({
|
|
indentor: css(
|
|
getResponsiveStyle(theme, spacing, (val) => ({
|
|
paddingLeft: theme.spacing(val * level),
|
|
}))
|
|
),
|
|
});
|