From 1f6f0059221f9d696e84f8c753b0257ea1cab84e Mon Sep 17 00:00:00 2001 From: Ian Mancini Date: Thu, 10 Dec 2020 21:08:37 -0300 Subject: [PATCH] Add /work page --- src/lib/api.ts | 19 ++++++++-------- src/pages/work.tsx | 56 ++++++++++++++++++++++++++++++++++++++++++++++ src/theme.ts | 3 +++ 3 files changed, 69 insertions(+), 9 deletions(-) create mode 100644 src/pages/work.tsx diff --git a/src/lib/api.ts b/src/lib/api.ts index cf7758e..c3a1559 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -57,9 +57,10 @@ export async function downloadFile(id: number, dir: string): Promise { return worksWithBanners } +export async function getInicioWithImage(): Promise { + const inicio = await getInicio() + const inicioWithImage = await extractUrlAndDownloadImage(inicio, 'fondo', assetsDir) + return inicioWithImage +} + export async function getWorkWithImages(id: number): Promise { const work = await getWorkById(id) const workWithBanner = extractUrlAndDownloadImage(work, 'banner', workImagesDir) @@ -223,10 +230,4 @@ export async function getTeamMembersWithImages(): Promise { - const inicio = await getInicio() - const inicioWithImage = await extractUrlAndDownloadImage(inicio, 'fondo', assetsDir) - return inicioWithImage -} - export default client diff --git a/src/pages/work.tsx b/src/pages/work.tsx new file mode 100644 index 0000000..30bcd5f --- /dev/null +++ b/src/pages/work.tsx @@ -0,0 +1,56 @@ +import { Stack, Heading, Text, Box, Flex, Link as ChakraLink } from '@chakra-ui/react' +import Link from 'next/link' + +import ResponsiveImage from '../components/ResponsiveImage' +import SEO from '../components/SEO' + +import { getAllWorksWithBanners, IWorkWithBanner, login } from '../lib/api' + +const Work: React.FC<{ data: IWorkWithBanner[] }> = ({ data }) => { + return ( + <> + + + + Work y cositas + + + {data.map((item, index) => ( + + + + + + {item.titulo} + + + {item.tags.map((tag) => ( + {tag} + ))} + + + + + ))} + + + + ) +} + +export default Work + +export async function getStaticProps() { + await login() + + const worksWithBanners = await getAllWorksWithBanners() + + return { props: { data: worksWithBanners } } +} diff --git a/src/theme.ts b/src/theme.ts index ab72686..83d5680 100644 --- a/src/theme.ts +++ b/src/theme.ts @@ -6,6 +6,9 @@ const customTheme = extendTheme({ colors: { blue, }, + radii: { + primary: '64px 64px 64px 0px', + }, fonts: { body: 'IBM Plex Sans, sans-serif', heading: 'IBM Plex Sans, sans-serif',