Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
6c17b083
Commit
6c17b083
authored
Sep 28, 2022
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
utilization color scheme
parent
30001725
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
Utilization.tsx
ui/shared/Utilization.tsx
+7
-3
No files found.
ui/shared/Utilization.tsx
View file @
6c17b083
...
@@ -4,18 +4,22 @@ import React from 'react';
...
@@ -4,18 +4,22 @@ import React from 'react';
interface
Props
{
interface
Props
{
className
?:
string
;
className
?:
string
;
value
:
number
;
value
:
number
;
colorScheme
?:
'
green
'
|
'
gray
'
;
}
}
const
WIDTH
=
50
;
const
WIDTH
=
50
;
const
Utilization
=
({
className
,
value
}:
Props
)
=>
{
const
Utilization
=
({
className
,
value
,
colorScheme
=
'
green
'
}:
Props
)
=>
{
const
valueString
=
(
value
*
100
).
toFixed
(
2
)
+
'
%
'
;
const
valueString
=
(
value
*
100
).
toFixed
(
2
)
+
'
%
'
;
const
colorGrayScheme
=
useColorModeValue
(
'
gray.500
'
,
'
gray.500
'
);
const
color
=
colorScheme
===
'
gray
'
?
colorGrayScheme
:
'
green.500
'
;
return
(
return
(
<
Flex
className=
{
className
}
alignItems=
"center"
>
<
Flex
className=
{
className
}
alignItems=
"center"
>
<
Box
bg=
{
useColorModeValue
(
'
blackAlpha.200
'
,
'
whiteAlpha.200
'
)
}
w=
{
`${ WIDTH }px`
}
h=
"4px"
borderRadius=
"full"
overflow=
"hidden"
>
<
Box
bg=
{
useColorModeValue
(
'
blackAlpha.200
'
,
'
whiteAlpha.200
'
)
}
w=
{
`${ WIDTH }px`
}
h=
"4px"
borderRadius=
"full"
overflow=
"hidden"
>
<
Box
bg=
"green.500"
w=
{
valueString
}
h=
"100%"
/>
<
Box
bg=
{
color
}
w=
{
valueString
}
h=
"100%"
/>
</
Box
>
</
Box
>
<
Text
color=
"green.500"
ml=
"10px"
fontWeight=
"bold"
>
{
valueString
}
</
Text
>
<
Text
color=
{
color
}
ml=
"10px"
fontWeight=
"bold"
>
{
valueString
}
</
Text
>
</
Flex
>
</
Flex
>
);
);
};
};
...
...
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