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
a5ca5dff
Commit
a5ca5dff
authored
Jan 20, 2020
by
Lukas Siatka
Committed by
Lukas Siatka
Jan 30, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Explore: adds MetaInfoText component
parent
db3797c1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
0 deletions
+65
-0
public/app/features/explore/MetaInfoText.tsx
+65
-0
No files found.
public/app/features/explore/MetaInfoText.tsx
0 → 100644
View file @
a5ca5dff
import
React
,
{
memo
,
useContext
}
from
'react'
;
import
{
css
}
from
'emotion'
;
import
{
GrafanaTheme
}
from
'@grafana/data'
;
import
{
stylesFactory
,
ThemeContext
}
from
'@grafana/ui'
;
const
getStyles
=
stylesFactory
((
theme
:
GrafanaTheme
)
=>
({
metaContainer
:
css
`
flex: 1;
color:
${
theme
.
colors
.
textWeak
}
;
margin-bottom:
${
theme
.
spacing
.
d
}
;
min-width: 30%;
display: flex;
`
,
metaItem
:
css
`
margin-right:
${
theme
.
spacing
.
d
}
;
display: flex;
align-items: baseline;
`
,
metaLabel
:
css
`
margin-right: calc(
${
theme
.
spacing
.
d
}
/ 2);
font-size:
${
theme
.
typography
.
size
.
sm
}
;
font-weight:
${
theme
.
typography
.
weight
.
semibold
}
;
`
,
metaValue
:
css
`
font-family:
${
theme
.
typography
.
fontFamily
.
monospace
}
;
`
,
}));
interface
MetaItemProps
{
label
?:
string
;
value
:
string
;
}
const
MetaInfoItem
=
memo
(
function
MetaInfoItem
(
props
:
MetaItemProps
)
{
const
theme
=
useContext
(
ThemeContext
);
const
style
=
getStyles
(
theme
);
const
{
label
,
value
}
=
props
;
return
(
<
div
className=
{
style
.
metaItem
}
>
{
label
&&
<
span
className=
{
style
.
metaLabel
}
>
{
label
}
:
</
span
>
}
<
span
className=
{
style
.
metaValue
}
>
{
value
}
</
span
>
</
div
>
);
});
export
interface
MetaInfoTextProps
{
metaItems
:
MetaItemProps
[];
}
export
const
MetaInfoText
=
memo
(
function
MetaInfoText
(
props
:
MetaInfoTextProps
)
{
const
theme
=
useContext
(
ThemeContext
);
const
style
=
getStyles
(
theme
);
const
{
metaItems
}
=
props
;
return
(
<
div
className=
{
style
.
metaContainer
}
>
{
metaItems
.
map
((
item
,
index
)
=>
(
<
MetaInfoItem
key=
{
`${index}-${item.label}`
}
label=
{
item
.
label
}
value=
{
item
.
value
}
/>
))
}
</
div
>
);
});
export
default
MetaInfoText
;
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