//WORDPRESS //import { Fade, Slide } from 'react-awesome-reveal' import Container from 'components/BlogContainer' import Layout from 'components/Layout' //import axios from "axios" import type { Settings } from 'lib/sanity.queries' import { getPage, getPaginationStatic } from 'lib/wordpress.data' import Image from 'next/image' import Link from 'next/link' import uniqid from 'uniqid' import { NextSeo } from 'next-seo' import { format, parseISO } from 'date-fns' import { IoCalendarOutline, IoNewspaperOutline } from 'react-icons/io5' import { getImageLink } from '../../../lib/wordpress.image' import { Latestpost } from '../../../lib/wordpress.queries' export interface NewsRoomPageProps { preview?: boolean newsroomposts: Latestpost[] loading?: boolean settings: Settings } const NO_POSTS: Latestpost[] = [] const url = 'https://cmswp.gwkbali.com/wp-json/wp/v2/mediacorner/' export default function page(props) { const { loading, newsroomposts, settings, preview, paginations } = props return ( <> Media Corner Press Releases {/* Regularly News and Media from GWK Bali */} {/* */} <> {newsroomposts.slice(0, 9).map((newsroompost) => { return ( {newsroompost.title.rendered} {format(new Date(newsroompost.date), 'dd-MM-yyyy')} Read more ) })} > {paginations.map((page) => { //console.log(uniqid) return ( {page.page} ) })} {/* */} > ) } export async function getStaticProps({ params }) { const { posts, paginations } = await getPage( url, '/media-corner/page/', params.page ) return { props: { newsroomposts: posts, paginations, }, } } export async function getStaticPaths() { const paginations = await getPaginationStatic(url) return { paths: paginations, fallback: false, } }
Regularly News and Media from GWK Bali