Skip to content

Commit

Permalink
Add carousel with news items to front page
Browse files Browse the repository at this point in the history
- news items displayed in carousel which scrolls every 3 seconds
- clicking on an item opens the associated url in a new window
- news items are stored in the file src/assets/news.json for now
  - could make it editable from the admin interface in the future
- uses vueperslides library
- resolves #37
  • Loading branch information
lkeegan committed Nov 6, 2024
1 parent 72f8150 commit 345174d
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 3 deletions.
3 changes: 2 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"flowbite-vue": "^0.1.6",
"pinia": "^2.2.2",
"vue": "^3.5.10",
"vue-router": "^4.4.5"
"vue-router": "^4.4.5",
"vueperslides": "^3.5.1"
},
"devDependencies": {
"@rushstack/eslint-patch": "^1.10.4",
Expand Down
15 changes: 15 additions & 0 deletions frontend/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@ const login_title = computed(() => {
<div class="flex flex-col items-stretch justify-center">
<RouterView />
</div>
<FooterComponent></FooterComponent>
<FooterComponent class="sticky"></FooterComponent>
</template>
26 changes: 26 additions & 0 deletions frontend/src/assets/news.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[
{
"url": "https://www.dkfz.de",
"text": "News item #1: some text about a paper written that used predicTCR. Click on this text to open the associated link."
},
{
"url": "https://www.dkfz.de",
"text": "News item #2: some text about a paper written that used predicTCR."
},
{
"url": "https://www.dkfz.de",
"text": "News item #3: some text about a paper written that used predicTCR."
},
{
"url": "https://www.dkfz.de",
"text": "News item #4: some text about a paper written that used predicTCR."
},
{
"url": "https://www.dkfz.de",
"text": "News item #5: some text about a paper written that used predicTCR."
},
{
"url": "https://www.dkfz.de",
"text": "News item #6: some text about a paper written that used predicTCR."
}
]
24 changes: 24 additions & 0 deletions frontend/src/components/CarouselComponent.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<script setup lang="ts">
import { VueperSlides, VueperSlide } from "vueperslides";
import "vueperslides/dist/vueperslides.css";
import items from "@/assets/news.json";
</script>

<template>
<vueper-slides
autoplay
duration="3000"
fixed-height="130px"
:touchable="false"
>
<vueper-slide v-for="item in items">

Check failure on line 14 in frontend/src/components/CarouselComponent.vue

View workflow job for this annotation

GitHub Actions / Frontend :: node 22

Custom elements in iteration require 'v-bind:key' directives
<template #content>
<div
class="h-full mx-14 flex flex-col justify-center text-slate-300 pb-4"
>
<a :href="item.url" target="_blank">{{ item.text }}</a>
</div>
</template>
</vueper-slide>
</vueper-slides>
</template>
4 changes: 3 additions & 1 deletion frontend/src/views/AboutView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import ListItem from "@/components/ListItem.vue";
import LoginComponent from "@/components/LoginComponent.vue";
import SignupComponent from "@/components/SignupComponent.vue";
import { RouterLink } from "vue-router";
import CarouselComponent from "@/components/CarouselComponent.vue";
const showModalLogin = ref(false);
function closeModals() {
showModalSignup.value = false;
Expand All @@ -29,7 +30,7 @@ function openModalSignup() {
header-classes="text-slate-100"
sub-text="Prediction of tumor-reactive T cells and TCRs from scRNA-seq data."
sub-text-classes="text-slate-300"
class="mb-4 bg-slate-800 bg-splash bg-no-repeat bg-center bg-cover md:rounded-lg"
class="mb-4 bg-slate-800 bg-splash bg-no-repeat bg-center bg-cover md:rounded-lg py-0 lg:py-0 pt-8 lg:pt-8"
>
<div class="flex flex-row justify-center">
<fwb-button
Expand All @@ -45,6 +46,7 @@ function openModalSignup() {
Log in
</fwb-button>
</div>
<CarouselComponent class="mt-4" />
</fwb-jumbotron>
<div class="p-4">
<ListComponent>
Expand Down

0 comments on commit 345174d

Please sign in to comment.