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