Skip to content

Commit

Permalink
Show first 9 of other titles
Browse files Browse the repository at this point in the history
Signed-off-by: Glenn Lewis <[email protected]>
  • Loading branch information
gmlewis committed Sep 17, 2024
1 parent 8ad3ab4 commit bc66077
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/components/DisplayBook.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="book-container">
<a :href="`https://on-demand-books.com/products/${url2handle(book[1])}`">
<a :href="shopifyUrl" @click.prevent="jumpTo">
<img :src="book[3]" width="384" height="576">
<span class="book-info">{{ book[0] }}
(ISBN: {{ book[2] }})</span>
Expand All @@ -9,13 +9,21 @@
</template>

<script setup>
import { computed } from 'vue'
const props = defineProps({
book: Array,
})
const shopifyUrl = computed(() => `https://on-demand-books.com/products/${url2handle(props.book[1])}`)
const url2handle = (url) => {
return url.replace(/^.*product\-/, '').replace(/\.html$/, '')
}
const jumpTo = () => {
window.parent.location = shopifyUrl.value
}
</script>

<style lang="scss" scoped>
Expand Down
2 changes: 1 addition & 1 deletion src/components/SearchBooks.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<div v-if="!books.length">
<div class="top-space">Other Available Titles</div>
<div class="books">
<div v-for="book in otherBooks" class="book">
<div v-for="book in otherBooks.slice(0, 9)" class="book">
<DisplayBook :book="book" />
</div>
</div>
Expand Down

0 comments on commit bc66077

Please sign in to comment.