From ed7bd8c4d28cb19ca12ef4187f37a937e5d6262a Mon Sep 17 00:00:00 2001 From: Arno Kaimbacher Date: Wed, 22 Dec 2021 16:48:59 +0100 Subject: [PATCH] - simple search box as extra vue component: simple-search-component --- src/assets/scss/main-styles.scss | 46 +++++------ .../simple-search/simple-search-component.ts | 12 +++ .../simple-search/simple-search-component.vue | 77 ++++++++++++++++++ src/components/vs-input/vs-input.vue | 4 + .../dataset-detail.component.ts | 9 ++- .../dataset-detail.component.vue | 78 +++++++++++++------ 6 files changed, 176 insertions(+), 50 deletions(-) create mode 100644 src/components/simple-search/simple-search-component.ts create mode 100644 src/components/simple-search/simple-search-component.vue diff --git a/src/assets/scss/main-styles.scss b/src/assets/scss/main-styles.scss index 97852b7..53366ea 100644 --- a/src/assets/scss/main-styles.scss +++ b/src/assets/scss/main-styles.scss @@ -256,30 +256,30 @@ body { display: none; } -.animate_content { - animation: animate 3s ease; -} +// .animate_content { +// animation: animate 3s ease; +// } -@keyframes animate { - 10% { - transform: scale(1, 0.004); - } - 35% { - transform: scale(0.001, 0.004); - opacity: 1; - } - 50% { - transform: scale(0.001, 0.004); - opacity: 0; - } - 85% { - transform: scale(1, 0.004); - opacity: 1; - } - 100% { - transform: scale(1, 1); - } -} +// @keyframes animate { +// 10% { +// transform: scale(1, 0.004); +// } +// 35% { +// transform: scale(0.001, 0.004); +// opacity: 1; +// } +// 50% { +// transform: scale(0.001, 0.004); +// opacity: 0; +// } +// 85% { +// transform: scale(1, 0.004); +// opacity: 1; +// } +// 100% { +// transform: scale(1, 1); +// } +// } .page_description { font-weight: 300; diff --git a/src/components/simple-search/simple-search-component.ts b/src/components/simple-search/simple-search-component.ts new file mode 100644 index 0000000..9f09847 --- /dev/null +++ b/src/components/simple-search/simple-search-component.ts @@ -0,0 +1,12 @@ +import { Options, Vue } from "vue-class-component"; + +@Options({ + name: "SimpleSearchComponent", +}) +export default class SimpleSearchComponent extends Vue { + public display = ""; + + search(): void { + this.$router.push({ name: "Search", params: { display: this.display } }); + } +} diff --git a/src/components/simple-search/simple-search-component.vue b/src/components/simple-search/simple-search-component.vue new file mode 100644 index 0000000..9b7cf52 --- /dev/null +++ b/src/components/simple-search/simple-search-component.vue @@ -0,0 +1,77 @@ + + + + + diff --git a/src/components/vs-input/vs-input.vue b/src/components/vs-input/vs-input.vue index 04b7618..cfbd982 100644 --- a/src/components/vs-input/vs-input.vue +++ b/src/components/vs-input/vs-input.vue @@ -113,6 +113,10 @@ export default VsInput; border-radius: 4px; color: #363636; } +input { + border-width: 0; + box-shadow: none; +} .autocomplete-results { padding: 0; diff --git a/src/views/dataset-detail.component.ts/dataset-detail.component.ts b/src/views/dataset-detail.component.ts/dataset-detail.component.ts index f49a97c..9e44f73 100644 --- a/src/views/dataset-detail.component.ts/dataset-detail.component.ts +++ b/src/views/dataset-detail.component.ts/dataset-detail.component.ts @@ -4,10 +4,13 @@ import { Prop } from "vue-property-decorator"; import DatasetService from "../../services/dataset.service"; import { Subscription } from "rxjs"; import moment from "moment"; +import SimpleSearchComponent from "@/components/simple-search/simple-search-component.vue"; @Options({ name: "DatasetDetailComponent", - // selector: "dataset-detail", + components: { + SimpleSearchComponent, + }, }) export default class DatasetDetailComponent extends Vue { @Prop() @@ -57,7 +60,7 @@ export default class DatasetDetailComponent extends Vue { return filename.substring(filename.lastIndexOf(".") + 1, filename.length) || filename; } - public formatSize(file_size: number, precision = 1) { + public formatSize(file_size: number): string { let size = file_size; const unit = ["Byte", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"]; let i; @@ -78,7 +81,7 @@ export default class DatasetDetailComponent extends Vue { // return moment(date).format("MMM Do YYYY"); } - public getYear(date: string) { + public getYear(date: string): string { return moment(date).format("YYYY"); } diff --git a/src/views/dataset-detail.component.ts/dataset-detail.component.vue b/src/views/dataset-detail.component.ts/dataset-detail.component.vue index 36b9a08..f40d57e 100644 --- a/src/views/dataset-detail.component.ts/dataset-detail.component.vue +++ b/src/views/dataset-detail.component.ts/dataset-detail.component.vue @@ -8,7 +8,37 @@ --> - +