StyleGuide: Minor fix for themes.md (#56012)

* Update themes.md

* Update themes.md

* Updates
This commit is contained in:
Torkel Ödegaard
2022-10-05 08:50:39 +02:00
committed by GitHub
parent 3f4bf76324
commit 580ca144fd

View File

@@ -25,16 +25,16 @@ import { GrafanaTheme2 } from '@grafana/data';
import { useStyles2 } from '@grafana/ui';
import { css } from '@emotion/css';
const getComponentStyles = (theme: GrafanaTheme2) => css`
padding: ${theme.spacing.md};
`;
const Foo: FC<FooProps> = () => {
const styles = useStyles2(getComponentsStyles);
function Foo(props: FooProps) {
const styles = useStyles2(getStyles);
// Use styles with className
};
}
```
const getStyles = (theme: GrafanaTheme2) => css({
padding: theme.spacing(1,2)
});
#### Get the theme object
```tsx