-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from rkshaon/rkshaon
frontend - book cover default, book details page
- Loading branch information
Showing
5 changed files
with
68 additions
and
9 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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 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,5 @@ | ||
export function getCoverImage (coverImage, baseURL) { | ||
const fallbackImage = '/book/default-cover-image.jpg' | ||
const imageURL = coverImage ? `${baseURL}${coverImage}` : `${fallbackImage}` | ||
return imageURL | ||
} |
This file contains 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,42 @@ | ||
<template> | ||
<div class="container mx-auto py-8 px-4 sm:px-6 lg:px-8"> | ||
<div v-if="book" class="bg-white shadow rounded-lg p-6"> | ||
<h1 class="text-3xl font-bold text-gray-800 mb-4">{{ book.title }}</h1> | ||
<p class="text-gray-600 mb-2">By {{ book.authors.map(author => author.full_name).join(', ') }}</p> | ||
<img v-if="book.coverImage" :src="book.coverImage" alt="Book Cover" class="w-full h-64 object-cover mb-4" /> | ||
<p class="text-gray-600">{{ book.description }}</p> | ||
</div> | ||
<div v-else> | ||
<p>Loading book details...</p> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: 'BookDetailsPage', | ||
data () { | ||
return { | ||
book: null // Store book data | ||
} | ||
}, | ||
mounted () { | ||
// this.fetchBookDetails(); | ||
}, | ||
methods: { | ||
// async fetchBookDetails() { | ||
// const bookId = this.$route.params.id; | ||
// try { | ||
// const response = await this.$axios.get(`${process.env.VUE_APP_BACKEND_URL}/book/v1/${bookId}/`); | ||
// this.book = response.data; | ||
// } catch (error) { | ||
// console.error('Error fetching book details:', error); | ||
// } | ||
// } | ||
} | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
/* Add custom styles here */ | ||
</style> |
This file contains 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