Skip to content

Commit

Permalink
Merge pull request #2 from nikkehtine-fm/feature-progressbars
Browse files Browse the repository at this point in the history
Add progress bars
  • Loading branch information
nikkehtine authored Oct 28, 2023
2 parents cf03640 + e4e0ed2 commit 9c2a460
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
1 change: 0 additions & 1 deletion src/components/SummaryIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import icon_visual from "../assets/icon-visual.svg";
* Another hilariously overengineered solution. Just how I like them.
*/
export default function Icon(props: { source: string }): JSX.Element {
console.log(props.source);
let icon: string;
let paths: string[] = props.source.split("/");
let target: string = paths[2].slice(
Expand Down
19 changes: 16 additions & 3 deletions src/components/SummaryProgessbars.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,29 @@ type ProgressbarProps = {
i: number;
};

const Graph = styled.div<{ $color: string }>`
const Graph = styled.div<{ $color: string; $value: number }>`
display: flex;
position: relative;
gap: 0.1rem;
padding: 0.75rem 1rem;
border-radius: 0.5rem;
margin-block: 1rem;
background-color: ${(props) => changeAlpha(props.$color, 5)};
background-color: ${(props) => changeAlpha(props.$color, 3)};
&::before {
content: "";
background-color: ${(props) => changeAlpha(props.$color, 10)};
height: 100%;
width: ${(props) => props.$value}%;
position: absolute;
top: 0;
left: 0;
z-index: 0;
border-radius: inherit;
}
> div {
display: flex;
z-index: 1;
}
.category {
flex-grow: 1;
Expand Down Expand Up @@ -58,7 +71,7 @@ export default function Progressbar({
let color: string = getBarColor(i);

return (
<Graph $color={color}>
<Graph $color={color} $value={score}>
<div className="category">
<SummaryIcon source={icon} />
<span>{category}</span>
Expand Down
5 changes: 4 additions & 1 deletion src/index.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
@import url("https://fonts.googleapis.com/css2?family=Hanken+Grotesk:wght@500;700;800&display=swap");

* {
*,
*::before,
*::after {
box-sizing: border-box;
margin: 0;
padding: 0;
Expand All @@ -11,6 +13,7 @@
line-height: 1.5;
font-size: 18px;
font-weight: 500;
-webkit-user-select: none;
user-select: none;

font-synthesis: none;
Expand Down

0 comments on commit 9c2a460

Please sign in to comment.