Skip to content

Commit

Permalink
feat: get counts working on subjects page
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilR8 committed Nov 21, 2024
1 parent 4328865 commit 643b3fe
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
8 changes: 8 additions & 0 deletions solution/ui/regulations/css/scss/partials/_subjects.scss
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,15 @@

&--label {
display: flex;
flex: 1;
flex-direction: column;

.count {
color: $secondary_text_color;
font-size: $font-size-xs;

@include font-bold-keep-width-reset;
}
}

button {
Expand Down
10 changes: 10 additions & 0 deletions solution/ui/regulations/css/scss/partials/_subjects_selector.scss
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,11 @@
}

.count {
font-size: $font-size-xs;
color: $secondary_text_color;
margin-left: var(--spacer-half);

@include font-bold-keep-width-reset;
}
}
}
Expand Down Expand Up @@ -217,6 +221,12 @@
display: flex;
justify-content: space-between;
line-height: 22px;

.count {
font-size: unset;
font-weight: unset;
color: unset;
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
<script>
const getCount = (subject) => {
return (
subject.count ??
(subject.public_resources ?? 0) + (subject.internal_resources ?? 0)
);
};
const getDisplayCount = (subject) => {
return subject.count ? `<span class="count">(${subject.count})</span>` : "";
return `<span class="count">(${getCount(subject)})</span>`;
};
export default {
Expand Down

0 comments on commit 643b3fe

Please sign in to comment.