|
|
|
@ -2,58 +2,64 @@ import Head from 'next/head'
|
|
|
|
|
import styles from '../styles/Gallery.module.css'
|
|
|
|
|
import Header from '../components/header';
|
|
|
|
|
import Footer from '../components/footer';
|
|
|
|
|
// import { google } from 'googleapis';
|
|
|
|
|
// import fs from 'fs';
|
|
|
|
|
// import readline from 'readline';
|
|
|
|
|
|
|
|
|
|
export default function Gallery() {
|
|
|
|
|
return (
|
|
|
|
|
<div className="page">
|
|
|
|
|
<Head>
|
|
|
|
|
<title>Trick - Gallery</title>
|
|
|
|
|
</Head>
|
|
|
|
|
export default function Gallery({ response }) {
|
|
|
|
|
let images = [];
|
|
|
|
|
for(const key in response) {
|
|
|
|
|
let item = response[key];
|
|
|
|
|
images.push(item['fields']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
<Header />
|
|
|
|
|
return (
|
|
|
|
|
<div className="page">
|
|
|
|
|
<Head>
|
|
|
|
|
<title>Trick - Gallery</title>
|
|
|
|
|
</Head>
|
|
|
|
|
|
|
|
|
|
<div className="container">
|
|
|
|
|
<article className="content">
|
|
|
|
|
<Header />
|
|
|
|
|
|
|
|
|
|
<section className="card">
|
|
|
|
|
<h1 className="h-unset">Gallery</h1>
|
|
|
|
|
<p>Coming Soon...</p>
|
|
|
|
|
</section>
|
|
|
|
|
<div className="container">
|
|
|
|
|
<article className="content">
|
|
|
|
|
|
|
|
|
|
</article>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<Footer />
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
<section className="card">
|
|
|
|
|
<h1 className="h-unset">Gallery</h1>
|
|
|
|
|
|
|
|
|
|
// export async function getServerSideProps() {
|
|
|
|
|
// const auth = new google.auth.GoogleAuth({
|
|
|
|
|
// keyFile: process.env.GOOGLE_APPLICATION_CREDENTIALS,
|
|
|
|
|
// scopes: ['https://www.googleapis.com/auth/spreadsheets.readonly']
|
|
|
|
|
// });
|
|
|
|
|
<div className={styles.gallery}>
|
|
|
|
|
{images.map((image) => (
|
|
|
|
|
<div>
|
|
|
|
|
<img src={image.link}></img>
|
|
|
|
|
<h4 style={{ textAlign: "center", margin: "unset" }}>{image.name}</h4>
|
|
|
|
|
</div>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
// const sheets = google.sheets({ version: 'v4', auth });
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
// const { id } = 2;
|
|
|
|
|
</article>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
// const range = `Gallery!A:${id}:B${id}`;
|
|
|
|
|
<Footer />
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// const response = sheets.spreadsheets.values.get({
|
|
|
|
|
// spreadsheetId: "13V7PXSJ6FSPZakBbYEpi1495T3nWxJ7Loi4EWwOZ7lE",
|
|
|
|
|
// range,
|
|
|
|
|
// });
|
|
|
|
|
async function getGallery() {
|
|
|
|
|
const req = await fetch("https://api.airtable.com/v0/appQnOyKBnBVQXLUM/Gallery", {
|
|
|
|
|
method: "GET",
|
|
|
|
|
headers: {
|
|
|
|
|
'Content-Type': 'application/json',
|
|
|
|
|
"Authorization": "Bearer " + process.env.AIRTABLE,
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// const data = await response.json();
|
|
|
|
|
|
|
|
|
|
const data = await req.json();
|
|
|
|
|
return data['records'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// return {
|
|
|
|
|
// props: {
|
|
|
|
|
// response: data
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
export async function getServerSideProps() {
|
|
|
|
|
return {
|
|
|
|
|
props: {
|
|
|
|
|
response: await getGallery()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|