Skip to content

Commit d0ebdb9

Browse files
committed
Added flippable book card
1 parent 11c7dc3 commit d0ebdb9

File tree

3 files changed

+46
-28
lines changed

3 files changed

+46
-28
lines changed

src/components/Books/Book.vue

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
<template>
22
<transition enter-active-class="bouncein" leave-active-class="bounceout">
33
<div class="book" v-if="this.imageThumbnail">
4-
<img :src='this.imageThumbnail' :alt='this.bookTitle' />
5-
<div class="overlay">{{ this.bookName.replace(/\b[A-Z0-9]{5,}\b/g, '') }}</div>
4+
<div class="book-inner">
5+
<div class="front">
6+
<img :src='this.imageThumbnail' :alt='this.bookTitle' class="book-img"/>
7+
</div>
8+
<div class="back">
9+
{{ this.bookName.replace(/\b[A-Z0-9]{5,}\b/g, '') }}
10+
</div>
11+
</div>
612
</div>
713
</transition>
814
</template>
@@ -59,31 +65,43 @@ export default {
5965
text-align: center;
6066
width: auto;
6167
height: 190px;
68+
background-color: transparent;
69+
perspective: 1000px;
6270
}
6371
64-
.book img {
65-
height: 190px;
72+
.book-inner {
73+
position: relative;
74+
width: 100%;
75+
height: 100%;
76+
text-align: center;
77+
transition: transform 0.8s;
78+
transform-style: preserve-3d;
6679
}
6780
68-
.overlay {
81+
.book:hover .book-inner {
82+
transform: rotateY(180deg);
83+
}
84+
85+
.front, .back {
6986
position: absolute;
70-
top: 0;
71-
left: 0;
72-
background: hsla(0, 0%, 0%, 0.7);
87+
width: 100%;
88+
height: 100%;
89+
-webkit-backface-visibility: hidden; /* Safari */
90+
backface-visibility: hidden;
91+
}
92+
93+
.book-img {
94+
height: 190px;
95+
}
96+
97+
.back {
98+
background-color: hsl(209, 50%, 54%);
99+
background-image: -webkit-linear-gradient(45deg, hsl(209, 70%, 40%) 50%, hsl(209, 64%, 49%) 50%);
73100
color: white;
101+
transform: rotateY(180deg);
74102
display: flex;
75103
justify-content: center;
76104
align-items: center;
77-
width: auto;
78-
padding: 2rem 0.5rem;
79-
margin-left: 1px;
80-
text-align: center;
81-
opacity: 0;
82-
transition: opacity 0.3s ease;
83-
}
84-
85-
.book:hover .overlay {
86-
opacity: 1;
87105
}
88106
89107
.bouncein {

src/components/Books/BookSection.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,14 @@ export default {
7373
display: flex;
7474
justify-content: space-between;
7575
background-color: hsl(209, 50%, 54%);
76-
background-image: -webkit-linear-gradient(45deg, hsl(209, 70%, 40%) 50%, hsl(209, 84%, 49%) 50%);
76+
background-image: -webkit-linear-gradient(45deg, hsl(209, 70%, 40%) 50%, hsl(209, 64%, 49%) 50%);
7777
}
7878
7979
.book-section-header:hover {
8080
cursor: pointer;
8181
transition: background 0.5s ease-in-out;
8282
background-color: hsl(209, 50%, 57%);
83-
background-image: -webkit-linear-gradient(45deg, hsl(209, 70%, 44%) 50%, hsl(209, 84%, 52%) 50%);
83+
background-image: -webkit-linear-gradient(45deg, hsl(209, 70%, 44%) 50%, hsl(209, 64%, 52%) 50%);
8484
}
8585
8686
.book {

src/resources/books/bookList2025.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
Tress of the Emerald Sea 9781938570346
2-
One Night at the Call Center
1+
Tress of the Emerald Sea by Brandon Sanderson 9781938570346
2+
One Night at the Call Center by Chetan Bhagat
33
The Fellowship of the Ring by JRR Tolkien 9780007322497
4-
The Grim Steeper
4+
The Grim Steeper by Gretchen Rue
55
Rogue Protocol by Martha Wells
66
The Bees by Laline Paull
77
Road to Ruin by Hana Lee
8-
The Will of the Many 9781982141172
9-
Purrder She Wrote
10-
2001 A Space Odyssey 0143111574
8+
The Will of the Many by James Islington 9781982141172
9+
Purrder She Wrote by Cat Conte
10+
2001 A Space Odyssey by Arthur Clarke 0143111574
1111
The Two Towers by JRR Tolkien
1212
Oathbringer by Brandon Sanderson 076532637X
1313
Foundation by Isaac Asimov 9780553293357
@@ -26,8 +26,8 @@ Before They Are Hanged by Joe Abercrombe
2626
The 7 1/2 Deaths of Evelyn Hardcastle by Stuart Turton
2727
He Who Drowned the World by Shelley Parker-Chan
2828
We'll Prescribe You a Cat by Syou Ishida
29+
Last Argument of Kings by Joe Abercrombe
2930
A Psalm for the Wild-Built by Becky Chambers
3031
A Prayer for the Crown-Shy by Becky Chambers
3132
Network Effect by Martha Wells
32-
A Nest of Nightmares by Lisa Tuttle
33-
Last Argument of Kings by Joe Abercrombe
33+
A Nest of Nightmares by Lisa Tuttle

0 commit comments

Comments
 (0)