Skip to content

Commit

Permalink
Merge pull request #87 from gdsc-ncku/yeeway
Browse files Browse the repository at this point in the history
Refactor component styles and update breadcrumb logic
  • Loading branch information
yeeway0609 authored Feb 29, 2024
2 parents 4dbc9fc + 4bdb435 commit dbf782c
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 18 deletions.
18 changes: 12 additions & 6 deletions src/components/Breadcrumb.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<script>
import departmentHandbookData from '../data/departmentHandbook.json';
import featuredArticlesData from '../data/featuredArticles.json';
import LetterToHighSchoolStudents from '../data/LetterToHighSchoolStudents.json';
export default {
data() {
Expand All @@ -37,19 +38,21 @@ export default {
if (this.$route.params) {
const dynamicParam = Object.values(this.$route.params)[0];
console.log(dynamicParam);
if (dynamicParam) {
const targetDepartment = departmentHandbookData.map((college) => {
return college.departments.find((department) => {
return department.id === dynamicParam;
});
}).filter(Boolean)[0]
// console.log(targetDepartment);
const targetArticle = featuredArticlesData.find((article) => {
return article.id === dynamicParam;
})
// console.log(targetArticle);
const targetLetter = LetterToHighSchoolStudents.find((letter) => {
return letter.id === dynamicParam;
})
if (targetDepartment) {
this.breadcrumbs.push({
Expand All @@ -61,11 +64,14 @@ export default {
to: this.$route.path,
label: targetArticle.title,
});
} else {
// error handling
} else if (targetLetter) {
this.breadcrumbs.push({
to: this.$route.path,
label: targetLetter.author,
});
}
}
// console.log(this.breadcrumbs);
}
},
},
Expand Down
4 changes: 2 additions & 2 deletions src/components/Letter.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<template>
<RouterLink
:to="link"
class="h-[18rem] w-[20rem] block rounded-lg pt-[6rem] group overflow-hidden last:mr-auto"
class="h-[18rem] w-[20rem] block rounded-lg pt-[6rem] group overflow-hidden"
>
<div class="w-full h-[12rem] relative isolate bg-primary-900">
<div class="absolute bottom-4 right-3 text-xl font-bold text-white">FROM {{ name }}</div>
<div class="absolute bottom-4 right-3 text-xl font-bold text-white">From {{ name }}</div>

<!-- letter closed -->
<div class="group-hover:hidden w-full h-[2rem] absolute top-0 bg-primary-700"></div>
Expand Down
Loading

0 comments on commit dbf782c

Please sign in to comment.