diff --git a/packages/grafana-ui/src/components/ThemeColors/Colors.story.tsx b/packages/grafana-ui/src/components/ThemeColors/Colors.story.tsx new file mode 100644 index 00000000000..4d448adb094 --- /dev/null +++ b/packages/grafana-ui/src/components/ThemeColors/Colors.story.tsx @@ -0,0 +1,18 @@ +import React from 'react'; +import { Colors } from './Colors'; + +export default { + title: 'Docs Overview/Colors', + component: Colors, + decorators: [], + parameters: { + options: { + showPanel: false, + }, + docs: {}, + }, +}; + +export const ColorsDemo = () => { + return ; +}; diff --git a/packages/grafana-ui/src/components/ThemeColors/Colors.tsx b/packages/grafana-ui/src/components/ThemeColors/Colors.tsx new file mode 100644 index 00000000000..f70ba40e0ab --- /dev/null +++ b/packages/grafana-ui/src/components/ThemeColors/Colors.tsx @@ -0,0 +1,75 @@ +import React from 'react'; +import { css, cx } from 'emotion'; +import darkTheme from '../../themes/dark'; +import lightTheme from '../../themes/light'; +import { useStyles } from '../../themes'; + +export const Colors = () => { + const styles = useStyles(getStyles); + const renderColors = (color: any) => { + return Object.entries(color) + .sort((a, b) => a[0].localeCompare(b[0])) + .map(([name, color]: [string, any]) => { + return ( +
+ + {name} ({color}) + + +
+ ); + }); + }; + + return ( +
+
+

Light theme

+

Palette

+ {renderColors(lightTheme.palette)} +

Colors

+ {renderColors(lightTheme.colors)} +
+ +
+

Dark theme

+

Palette

+ {renderColors(darkTheme.palette)} +

Colors

+ {renderColors(darkTheme.colors)} +
+
+ ); +}; + +const getStyles = () => { + return { + subheader: css` + margin: 20px 0; + `, + container: css` + display: flex; + justify-content: space-around; + width: 100%; + `, + wrapper: css` + display: flex; + align-items: center; + `, + name: css` + width: 250px; + `, + color: css` + display: inline-block; + width: 50px; + height: 50px; + `, + }; +};