oglasi: v prvi vrstici mreze oglas ni prva celica (na mobilnem sta bila pasica in kartica oglasa zapored pred prvim clankom)
This commit is contained in:
@@ -160,7 +160,10 @@ export default function CategoryPage({ fixedCategory }: { fixedCategory?: string
|
|||||||
let ai = 0;
|
let ai = 0;
|
||||||
let row = 0;
|
let row = 0;
|
||||||
while (ai < articles.length) {
|
while (ai < articles.length) {
|
||||||
const adCol = row % 4;
|
// V prvi vrstici oglas nikoli ne sme biti prva celica: na
|
||||||
|
// mobilnem je mreza enostolpcna, zato bi bralec po pasici na
|
||||||
|
// vrhu takoj dobil se en oglas in sele nato prvi clanek.
|
||||||
|
const adCol = row === 0 ? 3 : row % 4;
|
||||||
for (let col = 0; col < 4; col++) {
|
for (let col = 0; col < 4; col++) {
|
||||||
if (col === adCol) {
|
if (col === adCol) {
|
||||||
items.push(<ArticleCardAd key={`ad-row-${row}`} />);
|
items.push(<ArticleCardAd key={`ad-row-${row}`} />);
|
||||||
|
|||||||
@@ -871,7 +871,8 @@ export default function Home() {
|
|||||||
const rowStart = r * 4;
|
const rowStart = r * 4;
|
||||||
const hasWidget = items.slice(rowStart, rowStart + 4).some((it) => it.type === "widget");
|
const hasWidget = items.slice(rowStart, rowStart + 4).some((it) => it.type === "widget");
|
||||||
if (!hasWidget) {
|
if (!hasWidget) {
|
||||||
const pos = adCount % 2 === 0 ? 0 : 3;
|
// Enako kot na straneh rubrik: v prvi vrstici oglas ni prva celica.
|
||||||
|
const pos = r === 0 ? 3 : adCount % 2 === 0 ? 0 : 3;
|
||||||
items[rowStart + pos] = { type: "ad", key: `ad-row-${adCount++}` };
|
items[rowStart + pos] = { type: "ad", key: `ad-row-${adCount++}` };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user