-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
José Luis Pereira
committed
Aug 9, 2022
1 parent
79ea428
commit d4bec27
Showing
5 changed files
with
116 additions
and
6 deletions.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| <template> | ||
| <svg | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| fill="none" | ||
| viewBox="0 0 24 24" | ||
| stroke="currentColor" | ||
| stroke-width="2" | ||
| > | ||
| <path | ||
| stroke-linecap="round" | ||
| stroke-linejoin="round" | ||
| d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" | ||
| /> | ||
| </svg> | ||
| </template> | ||
|
|
||
| <script setup> | ||
| </script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| <template> | ||
| <VCard> | ||
| <VCardHeader> | ||
| <h1 class="text-md"> | ||
| Content | ||
| </h1> | ||
| </VCardHeader> | ||
| <VCardContent class="text-sm"> | ||
| <ContentTopic | ||
| v-for="(text, title) in contentList" | ||
| :key="title" | ||
| class="mb-6 last:mb-0" | ||
| :title="title" | ||
| :text-list="text" | ||
| /> | ||
| </VCardContent> | ||
| </VCard> | ||
| </template> | ||
|
|
||
| <script setup> | ||
| import { computed, ref, watch } from 'vue' | ||
| import OtuService from '../../services/OtuService' | ||
| import ContentTopic from './ContentTopic.vue' | ||
| const props = defineProps({ | ||
| otuId: { | ||
| type: Number, | ||
| default: undefined | ||
| } | ||
| }) | ||
| const contents = ref([]) | ||
| const contentList = computed(() => | ||
| contents.value.reduce((acc, current) => { | ||
| if (acc[current.name]) { | ||
| acc[current.name].push(current.text) | ||
| } else { | ||
| acc[current.name] = [current.text] | ||
| } | ||
| return acc | ||
| }, {}) | ||
| ) | ||
| watch( | ||
| () => props.otuId, | ||
| id => { | ||
| if (id) { | ||
| OtuService.getContent(id).then(({ data }) => { | ||
| contents.value = data | ||
| }) | ||
| } else { | ||
| contents.value = [] | ||
| } | ||
| }, | ||
| { immediate: true } | ||
| ) | ||
| </script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| <template> | ||
| <div> | ||
| <h2 class="text-sm font-medium flex"> | ||
| <IconDocument class="h-4 w-4 mr-1" /> | ||
| {{ title }} | ||
| </h2> | ||
| <ul | ||
| v-for="(text, index) in textList" | ||
| :key="index" | ||
| class="pt-1 pl-5" | ||
| > | ||
| <li v-html="text" /> | ||
| </ul> | ||
| </div> | ||
| </template> | ||
|
|
||
| <script setup> | ||
| defineProps({ | ||
| title: { | ||
| type: String, | ||
| required: true | ||
| }, | ||
| textList: { | ||
| type: Array, | ||
| required: true | ||
| } | ||
| }) | ||
| </script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters