Skip to content

Commit

Permalink
[Scorecards][General] Added percentage ring component
Browse files Browse the repository at this point in the history
  • Loading branch information
lucascumsille committed Oct 16, 2024
1 parent c97032f commit 47c082e
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions scoring/static/scoring/scss/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,4 @@
@import "open-graph-preview";
@import "years";
@import "gallery-component";
@import "percentage-ring";
36 changes: 36 additions & 0 deletions scoring/static/scoring/scss/percentage-ring.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/* USAGE:
Always check how the ring will look at 100% and if there is an overlap between elements.
<div class="progress-ring" style="--ring-size: 40px;--ring-percentage: {% widthratio answer.council_count council_count 100%};">
<div class="percentage fs-8">
{% widthratio answer.council_count council_count 100%}%
</div>
</div>
*/

.progress-ring {
min-width: var(--ring-size, 150px);
height: var(--ring-size, 150px);
border-radius: 50%;
position: relative;
display: flex;
justify-content: center;
align-items: center;
background: conic-gradient(
var(--ring-primary-color, $primary) 0% calc(var(--ring-percentage) * 1%),
var(--ring-secondary-color, $primary-200) calc(var(--ring-percentage) * 1%) 100%
);

.percentage {
font-weight: bold;
color: var(--ring-primary-color, $primary);
position: absolute;
display: flex;
justify-content: center;
align-items: center;
width: calc(var(--ring-size, 150px) * 0.7);
height: calc(var(--ring-size, 150px) * 0.7);
background: white;
border-radius: 50%;
}
}

0 comments on commit 47c082e

Please sign in to comment.