update featured news limit
This commit is contained in:
@ -85,7 +85,7 @@ export default async function Home() {
|
|||||||
<Pig type="point" />
|
<Pig type="point" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<NewsList heading="Siste nytt" limit={4} featured news={news} />
|
<NewsList heading="Siste nytt" featured news={news} />
|
||||||
</main>
|
</main>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ export const NewsList = ({
|
|||||||
heading?: string;
|
heading?: string;
|
||||||
featured?: boolean;
|
featured?: boolean;
|
||||||
}) => {
|
}) => {
|
||||||
const [limit, setLimit] = useState(17);
|
const [limit, setLimit] = useState(featured ? 4 : 17);
|
||||||
function increaseLimit() {
|
function increaseLimit() {
|
||||||
setLimit(limit + 16);
|
setLimit(limit + 16);
|
||||||
}
|
}
|
||||||
@ -29,7 +29,7 @@ export const NewsList = ({
|
|||||||
<NewsItem key={singleNews.id} news={singleNews} />
|
<NewsItem key={singleNews.id} news={singleNews} />
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
{limit && news.length > limit && (
|
{!featured && limit && news.length > limit && (
|
||||||
<div className={styles.showMore}>
|
<div className={styles.showMore}>
|
||||||
<button onClick={increaseLimit}>
|
<button onClick={increaseLimit}>
|
||||||
<span>Last inn flere artikler</span>
|
<span>Last inn flere artikler</span>
|
||||||
|
Reference in New Issue
Block a user