Skip to content

Commit

Permalink
Update functions and variables names for easier readability
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandrecoin committed Oct 16, 2020
1 parent 5a8d26a commit 3a9382a
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions components/slices/MultipleBlock.vue
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export default {
const isObjectConstructor = item.item_image.constructor === Object
return isLengthDifferentThanZero && isObjectConstructor
},
findNbItemsInRow() {
numberItemsPerRowForScreenWidth() {
if (process.client) {
const isLargeScreen = document.body.clientWidth >= DESKTOP_MIN_WIDTH
const isExtraLargeScreen =
Expand All @@ -130,9 +130,17 @@ export default {
},
splitItemsIntoRows() {
const rows = []
const chunkSize = this.findNbItemsInRow()
for (let i = 0; i < this.items.length; i += chunkSize) {
rows.push(this.items.slice(i, i + chunkSize))
const numberOfItemsPerRow = this.numberItemsPerRowForScreenWidth()
for (
let item = 0;
item < this.items.length;
item += numberOfItemsPerRow
) {
const screenSizedItems = this.items.slice(
item,
item + numberOfItemsPerRow
)
rows.push(screenSizedItems)
}
return rows
},
Expand Down

0 comments on commit 3a9382a

Please sign in to comment.