Skip to content

Commit

Permalink
Add image support
Browse files Browse the repository at this point in the history
  • Loading branch information
energee committed Dec 9, 2023
1 parent 2cc291a commit 223c96c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
1 change: 1 addition & 0 deletions _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ <h1>{{ page.title }}</h1>
</a>
<img v-if="item.glutenFree == 'TRUE'" class="gf" src="./assets/gluten-free.svg"></img>
</span>
<img v-if="item.entryImage" class="draft-entry-image" :src="item.entryImage" />
<span v-if="item.type" class="beer-style">${ item.type }</span>
<div v-if="item.options" class="options">
<span v-for="option in (item.options.split('|'))">
Expand Down
5 changes: 5 additions & 0 deletions _sass/main.sass
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,11 @@ img[src$=".webp"]
[data-tap="10"] .tap
transform: translateX(-7px)

.draft-entry-image
display: inline
height: 75px
vertical-align: middle

.tap
display: inline-block
letter-spacing: 3px
Expand Down
17 changes: 14 additions & 3 deletions assets/js/render-beer-persist.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ new Vue({
});
return item;
});

this.items = items;
this.$nextTick(this.changeColors);
} catch (error) {
Expand Down Expand Up @@ -58,6 +57,16 @@ new Vue({
let offsetRight = boundingBox.right + window.pageXOffset;
return { left: offsetLeft, right: offsetRight };
},
addCounts() {
// Count all 'article' tags
var articleCount = document.querySelectorAll('article').length;

// Select the '#app' element, remove all existing classes, and add the new count class
var appElement = document.querySelector('#app');
if (appElement) {
appElement.className = 'count-' + articleCount;
}
},
getWidths() {
let articles = document.querySelectorAll("article");

Expand Down Expand Up @@ -88,7 +97,7 @@ new Vue({
},
adjustPosition(app) {
let height = app.offsetHeight;
let margin = (window.innerHeight - height) / 2
let margin = (window.innerHeight - height) / 2;
app.style.marginTop = (75 + margin) + 'px';
},
changeColors() {
Expand Down Expand Up @@ -117,7 +126,9 @@ new Vue({
}, 10000);
setInterval(() => {
this.loadData(id, tab);
console.log('Data updated from Google Sheets')
console.log('Data updated from Google Sheets');
this.addCounts();
console.log("counts")
}, 10000);
}
});

0 comments on commit 223c96c

Please sign in to comment.