Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Valexr committed Apr 27, 2024
1 parent ebf794a commit 8dde4cd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ type Slide = {
}

type Counter = {
// [x: string]: any;
id: number,
title: string,
quote: Quote,
Expand Down
9 changes: 6 additions & 3 deletions src/lib/components/Counter.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@
let type: keyof Translate;
function length(counter: Counter) {
function length(counter: Counter, type: keyof Translate) {
const { id, title, quote, start, full, ...rest } = counter;
return Object.values(rest).filter((r) => r).length;
const values = Object.values(rest)
.filter((r) => r)
.join("");
return !type ? values.length : String(full[type]).length;
}
</script>

<ul style="--county-length: {length(counter)}">
<ul style="--county-length: {length(counter, type)}">
{#if type === "months"}
<County name="months" value={counter.full.months} bind:type />
{:else if type === "weeks"}
Expand Down

0 comments on commit 8dde4cd

Please sign in to comment.