From ea68b5d8017136845936bbea24ba988c511d4acf Mon Sep 17 00:00:00 2001 From: Henrik Giesel Date: Fri, 25 Dec 2020 22:29:42 +0100 Subject: [PATCH] Put RangeBox into its own component --- ts/graphs/GraphsPage.svelte | 115 ++++-------------------------------- ts/graphs/RangeBox.svelte | 109 ++++++++++++++++++++++++++++++++++ ts/graphs/bootstrap.ts | 4 +- 3 files changed, 124 insertions(+), 104 deletions(-) create mode 100644 ts/graphs/RangeBox.svelte diff --git a/ts/graphs/GraphsPage.svelte b/ts/graphs/GraphsPage.svelte index 1f9c3c1ce..61e28053b 100644 --- a/ts/graphs/GraphsPage.svelte +++ b/ts/graphs/GraphsPage.svelte @@ -3,6 +3,7 @@ {#if withRangeBox} -
-
- - - - { - searchRange = SearchRange.Custom; - }} - placeholder={searchLabel} /> -
- -
- - -
-
-
+ {/if}
diff --git a/ts/graphs/RangeBox.svelte b/ts/graphs/RangeBox.svelte new file mode 100644 index 000000000..ca18750d3 --- /dev/null +++ b/ts/graphs/RangeBox.svelte @@ -0,0 +1,109 @@ + + + +
+
+ + + + { + searchRange = SearchRange.Custom; + }} + placeholder={searchLabel} /> +
+ +
+ + +
+
+ +
diff --git a/ts/graphs/bootstrap.ts b/ts/graphs/bootstrap.ts index 6d6271e60..fba7bc183 100644 --- a/ts/graphs/bootstrap.ts +++ b/ts/graphs/bootstrap.ts @@ -22,7 +22,7 @@ export function graphs( target: HTMLDivElement, graphs: any[], { search = "deck:current", - revlogRange = RevlogRange.Year, + days = 365, withRangeBox = true, } = {}, ): void { @@ -36,7 +36,7 @@ export function graphs( graphs, nightMode, search, - revlogRange, + days, withRangeBox, }, });