Skip to content

Commit

Permalink
fix: render fallback no todos
Browse files Browse the repository at this point in the history
fix: collection description
  • Loading branch information
nnivxix committed Oct 31, 2024
1 parent 68115cb commit 61f4ea5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
17 changes: 11 additions & 6 deletions src/components/ExampleJson.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,17 @@ const example = `
>
</highlightjs>
<div v-else>
<TodoItem
v-for="(todo, index) in json.todos"
:key="index"
:todo="todo"
:preview="true"
/>
<template v-if="json.todos.length">
<TodoItem
v-for="(todo, index) in json.todos"
:key="index"
:todo="todo"
:preview="true"
/>
</template>
<template v-else>
<p>No Todos</p>
</template>
</div>
</template>
<template v-else>
Expand Down
5 changes: 0 additions & 5 deletions src/composables/useCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ const collection = ref({
const collections = ref([]);

const useCollection = () => {
const descriptionCollection = computed(() => {
return collection.value?.description.replace(/(?:\r\n|\r|\n)/g, "<br>");
});

/** @param {Collection} collection */
const addCollection = (collection) => {
collections.value.push(collection);
Expand Down Expand Up @@ -70,7 +66,6 @@ const useCollection = () => {
return {
collections,
collection,
descriptionCollection,
addCollection,
getCollections,
getDetailCollection,
Expand Down
10 changes: 5 additions & 5 deletions src/pages/collection/id.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import exportCollection from "@/utils/export-collection";
const route = useRoute();
const router = useRouter();
const { deleteColllection, collection, descriptionCollection } =
useCollection();
const { deleteColllection, collection } = useCollection();
const { addTodo, markTodo, editTodo, deleteTodo, doneTodos, todos } = useTodo();
const { formTodo, isEditing, resetForm: resetFormTodo } = useFormTodo();
const vFormTodo = useForm({
Expand Down Expand Up @@ -131,9 +130,10 @@ onMounted(async () => {
<hr />
<p
v-if="!!collection.description"
class="text-lg pb-3"
v-html="descriptionCollection"
></p>
class="text-lg pb-3 whitespace-pre-line"
>
{{ collection.description }}
</p>
<p v-else class="text-gray-500 pb-3">no description</p>
<ProgressBar
:totalTodos="todos.length"
Expand Down

0 comments on commit 61f4ea5

Please sign in to comment.