Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
8d9b4e4a
Unverified
Commit
8d9b4e4a
authored
Dec 15, 2020
by
Alex Khomenko
Committed by
GitHub
Dec 15, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Display palette and colors for dark and light themes in storybook (#29848)
parent
555d3c27
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
93 additions
and
0 deletions
+93
-0
packages/grafana-ui/src/components/ThemeColors/Colors.story.tsx
+18
-0
packages/grafana-ui/src/components/ThemeColors/Colors.tsx
+75
-0
No files found.
packages/grafana-ui/src/components/ThemeColors/Colors.story.tsx
0 → 100644
View file @
8d9b4e4a
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
<
Colors
/>;
};
packages/grafana-ui/src/components/ThemeColors/Colors.tsx
0 → 100644
View file @
8d9b4e4a
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
(
<
div
key=
{
name
}
className=
{
styles
.
wrapper
}
>
<
span
className=
{
styles
.
name
}
>
{
name
}
(
{
color
}
)
</
span
>
<
span
className=
{
cx
(
styles
.
color
,
css
`
background: ${color};
`
)
}
/>
</
div
>
);
});
};
return
(
<
div
className=
{
styles
.
container
}
>
<
div
>
<
h2
>
Light theme
</
h2
>
<
h3
className=
{
styles
.
subheader
}
>
Palette
</
h3
>
{
renderColors
(
lightTheme
.
palette
)
}
<
h3
className=
{
styles
.
subheader
}
>
Colors
</
h3
>
{
renderColors
(
lightTheme
.
colors
)
}
</
div
>
<
div
>
<
h2
>
Dark theme
</
h2
>
<
h3
className=
{
styles
.
subheader
}
>
Palette
</
h3
>
{
renderColors
(
darkTheme
.
palette
)
}
<
h3
className=
{
styles
.
subheader
}
>
Colors
</
h3
>
{
renderColors
(
darkTheme
.
colors
)
}
</
div
>
</
div
>
);
};
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;
`
,
};
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment