Skip to content

Commit

Permalink
Use word listing component in List view
Browse files Browse the repository at this point in the history
  • Loading branch information
pasikonik committed Mar 2, 2023
1 parent 2e1ff34 commit 62b2ff5
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions src/views/List.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import { Ref, ref, watch } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { useListStore } from '@/stores/list'
import List from '@/types/list'
import Word from '@/types/word'
import NewWordForm from '@/components/NewWordForm.vue'
import WordListing from '@/components/WordListing.vue'
const list: Ref<List | null> = ref(null)
Expand All @@ -15,10 +17,9 @@ watch(
() => route.params.id as string,
async (newId) => {
list.value = await store.fetchList(newId)
}
, { immediate: true })
},
{ immediate: true }
)
const deleteList = async () => {
if (!list.value) return
Expand All @@ -33,9 +34,9 @@ const deleteList = async () => {
<h2 class="text-h2">
{{ list.name }}
</h2>

<v-btn
class="deleteButton"
class="delete-button"
icon="mdi-trash-can-outline"
color="error"
size="small"
Expand All @@ -47,23 +48,19 @@ const deleteList = async () => {

<new-word-form :list-id="list.id" />

<div>
<div v-for="word in list.words" :key="word.id">
{{ word.origin }} - {{ word.translation }} - {{ word.proficiency }}
</div>
</div>
<word-listing :words="list.words as Word[]" />
</main>
</template>

<style scoped>list
<style scoped>
.container {
position: relative;
}
.deleteButton {
.delete-button {
position: absolute;
top: 85px;
right: 20px;
top: 0;
right: 0;
border: 0;
}
</style>

0 comments on commit 62b2ff5

Please sign in to comment.