Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Headlamp
Commits
b7ba608b
Commit
b7ba608b
authored
3 years ago
by
René Dudfield
Committed by
Joaquim Rocha
3 years ago
Browse files
Options
Download
Email Patches
Plain Diff
plugins: Show how to use styles inside a plugin
parent
ac773fd1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
plugins/examples/pod-counter/src/index.tsx
+14
-8
plugins/examples/pod-counter/src/index.tsx
with
14 additions
and
8 deletions
+14
-8
plugins/examples/pod-counter/src/index.tsx
+
14
-
8
View file @
b7ba608b
import
React
from
'
react
'
;
import
{
Headlamp
,
Plugin
,
Registry
,
K8s
}
from
'
@kinvolk/headlamp-plugin/lib
'
;
import
{
Headlamp
,
K8s
,
Plugin
,
Registry
}
from
'
@kinvolk/headlamp-plugin/lib
'
;
import
{
Typography
}
from
'
@material-ui/core
'
;
import
{
makeStyles
}
from
'
@material-ui/styles
'
;
import
React
from
'
react
'
;
// import { SectionBox } from '@kinvolk/headlamp-plugin/lib/CommonComponents';
const
useStyle
=
makeStyles
(()
=>
({
pods
:
{
fontStyle
:
'
italic
'
,
},
}));
function
PodCounter
()
{
const
classes
=
useStyle
();
const
[
pods
,
error
]
=
K8s
.
ResourceClasses
.
Pod
.
useList
();
const
msg
=
pods
===
null
?
'
Loading…
'
:
pods
.
length
.
toString
();
return
(
<
Typography
color
=
"textPrimary"
>
{
!
error
?
`# Pods:
${
msg
}
`
:
'
Uh, pods!?
'
}
</
Typography
>
<
Typography
color
=
"textPrimary"
className
=
{
classes
.
pods
}
>
{
!
error
?
`# Pods:
${
msg
}
`
:
'
Uh, pods!?
'
}
</
Typography
>
);
}
class
PodCounterPlugin
extends
Plugin
{
initialize
(
registry
:
Registry
)
{
registry
.
registerAppBarAction
(
'
pod-counter-action
'
,
()
=>
<
PodCounter
/>
);
registry
.
registerAppBarAction
(
'
pod-counter-action
'
,
()
=>
<
PodCounter
/>);
return
true
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
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
Menu
Projects
Groups
Snippets
Help