FieldSet: updates components with the new theme model (#33640)

This commit is contained in:
Uchechukwu Obasi 2021-05-04 16:08:53 +01:00 committed by GitHub
parent 907d7b71dc
commit 3b11e7318a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,7 @@
import React, { FC, HTMLProps } from 'react';
import { css, cx } from '@emotion/css';
import { GrafanaTheme } from '@grafana/data';
import { stylesFactory, useTheme } from '../../themes';
import { GrafanaTheme2 } from '@grafana/data';
import { stylesFactory, useTheme2 } from '../../themes';
import { Legend } from './Legend';
export interface Props extends HTMLProps<HTMLFieldSetElement> {
@ -11,7 +11,7 @@ export interface Props extends HTMLProps<HTMLFieldSetElement> {
}
export const FieldSet: FC<Props> = ({ label, children, className, ...rest }) => {
const theme = useTheme();
const theme = useTheme2();
const styles = getStyles(theme);
return (
@ -22,10 +22,10 @@ export const FieldSet: FC<Props> = ({ label, children, className, ...rest }) =>
);
};
const getStyles = stylesFactory((theme: GrafanaTheme) => {
const getStyles = stylesFactory((theme: GrafanaTheme2) => {
return {
wrapper: css`
margin-bottom: ${theme.spacing.formSpacingBase * 4}px;
margin-bottom: ${theme.spacing(4)};
&:last-child {
margin-bottom: 0;