forked from konveyor/editor-extensions
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Add counts and styling for incident / issues (konveyor#145)
<img width="890" alt="Screenshot 2024-12-09 at 4 43 25 PM" src="https://github.com/user-attachments/assets/9446645e-0eaf-43b0-8419-241ba0e0f563"> Signed-off-by: Ian Bolton <[email protected]>
- Loading branch information
1 parent
379220e
commit b781ac7
Showing
5 changed files
with
116 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
.header-layout { | ||
align-items: center; | ||
gap: 16px; | ||
min-height: 36px; | ||
padding: 4px 0; | ||
} | ||
|
||
.vertical-divider { | ||
width: 1px; | ||
height: 24px; | ||
background-color: #d2d2d2; | ||
margin: 0 8px; | ||
align-self: center; | ||
} |
35 changes: 35 additions & 0 deletions
35
webview-ui/src/components/ViolationsCount/ViolationsCount.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import "./styles.css"; | ||
import React from "react"; | ||
import { Content } from "@patternfly/react-core"; | ||
import spacing from "@patternfly/react-styles/css/utilities/Spacing/spacing"; | ||
|
||
interface ViolationsCountProps { | ||
violationsCount: number; | ||
incidentsCount: number; | ||
} | ||
|
||
export const ViolationsCount: React.FC<ViolationsCountProps> = ({ | ||
violationsCount, | ||
incidentsCount, | ||
}) => { | ||
const getStatusText = (count: number) => { | ||
if (count === 0) { | ||
return "(No incidents found)"; | ||
} else if (count === 1) { | ||
return "(1 incident found)"; | ||
} else { | ||
return `(${count} incidents found)`; | ||
} | ||
}; | ||
|
||
return ( | ||
<div className="violations-count"> | ||
<Content component={"h4"} className="violations-title"> | ||
Total Issues: {violationsCount} | ||
</Content> | ||
<Content component={"small"} className={`${spacing.mlSm} violations-subtitle`}> | ||
{getStatusText(incidentsCount)} | ||
</Content> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
.violations-count { | ||
display: flex; | ||
align-items: center; | ||
gap: 8px; | ||
} | ||
|
||
.violations-title { | ||
color: #d2d2d2 !important; | ||
font-size: 14px !important; | ||
line-height: 20px !important; | ||
margin: 0 !important; | ||
display: flex; | ||
align-items: center !important; | ||
font-weight: 400 !important; | ||
} | ||
|
||
.violations-subtitle { | ||
font-style: italic; | ||
color: #d2d2d2; | ||
font-size: 14px; | ||
line-height: 20px; | ||
} | ||
|
||
.violations-compact { | ||
color: #d2d2d2 !important; | ||
font-size: 14px !important; | ||
line-height: 20px !important; | ||
margin: 0 !important; | ||
display: flex; | ||
align-items: center !important; | ||
} |