Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
b6a0e60
Initial commit from Create Next App
yuribmontez Sep 22, 2021
00eb4b1
Initial commit
yuribmontez Sep 22, 2021
c322f26
chore: add next image config
yuribmontez Sep 22, 2021
b78b0ff
feat: add chakra, react-icons, swiper
yuribmontez Sep 22, 2021
6b172d7
feat: add app fonts & images
yuribmontez Sep 22, 2021
b18e62a
parcial: app theme
yuribmontez Sep 22, 2021
83ea3ab
feat: add foton favicon
yuribmontez Sep 22, 2021
970a0b1
chore: add chakra theme provider
yuribmontez Sep 22, 2021
f37b86a
feat: custom chakra theme
yuribmontez Sep 26, 2021
bdac683
add swiper, axios
yuribmontez Sep 26, 2021
55d7baa
feat: roboto font, foton favicon
yuribmontez Sep 26, 2021
94c558d
feat: google books api functions
yuribmontez Sep 26, 2021
16139b8
feat: home page
yuribmontez Sep 26, 2021
a7b476f
feat: book search & details page
yuribmontez Sep 26, 2021
ab3b04d
add debouncer
yuribmontez Sep 26, 2021
923ec2d
feat: add wrapper component
yuribmontez Sep 26, 2021
6e3398d
feat: home page section headings
yuribmontez Sep 26, 2021
5fde390
feat: searchbox component
yuribmontez Sep 26, 2021
d0899f9
feat: navbar component
yuribmontez Sep 26, 2021
9e85f33
feat: app icons
yuribmontez Sep 26, 2021
1211e96
feat: book card swiper
yuribmontez Sep 26, 2021
2ad18b8
feat: currently reading card
yuribmontez Sep 26, 2021
9208c34
Merge branch 'master' of https://github.com/yuribmontez/frontend-chal…
yuribmontez Sep 26, 2021
ffaf9dd
Update README.md
yuribmontez Sep 27, 2021
43ab110
feat: add load more button
yuribmontez Sep 27, 2021
5d18fde
fix: data fetching services
yuribmontez Sep 27, 2021
bc59b81
Merge branch 'master' of https://github.com/yuribmontez/frontend-chal…
yuribmontez Sep 27, 2021
5c63437
update: add startIndex to loadMore query params
yuribmontez Sep 27, 2021
2b6f4a0
fix: current book card spacing
yuribmontez Sep 28, 2021
21ee4a4
update: card swiper animation to framer-motion
yuribmontez Sep 28, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local

# vercel
.vercel
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Frontend Challenge

Checkout the live version of the challenge [here](https://foton-frontend-challenge-yuribmontez.vercel.app)

<hr>

Clone this repository and start our challenge **right now**

Use React or React Native depending on the rule you are running for.
Expand Down
6 changes: 6 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
reactStrictMode: true,
images: {
domains: ["books.google.com"]
}
}
26 changes: 26 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "foton",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@chakra-ui/react": "^1.6.8",
"@emotion/react": "^11",
"@emotion/styled": "^11",
"axios": "^0.21.4",
"framer-motion": "^4",
"next": "11.1.2",
"react": "17.0.2",
"react-dom": "17.0.2",
"swiper": "^7.0.6"
},
"devDependencies": {
"eslint": "7.32.0",
"eslint-config-next": "11.1.2"
}
}
Binary file added public/fonts/SF-Pro-Display-Bold.otf
Binary file not shown.
Binary file added public/fonts/SF-Pro-Display-Regular.otf
Binary file not shown.
Binary file added public/fonts/SF-Pro-Text-Regular.otf
Binary file not shown.
17 changes: 17 additions & 0 deletions public/fonts/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@import url("https://fonts.googleapis.com/css2?family=Playfair+Display&family=Roboto&display=swap");

@font-face {
font-family: "SFProDisplay";
src: url("/fonts/SF-Pro-Display-Regular.otf") format("opentype");
}

@font-face {
font-family: "SFProDisplay";
src: url("/fonts/SF-Pro-Display-Bold.otf") format("opentype");
font-weight: bold;
}

@font-face {
font-family: "SFProText";
src: url("/fonts/SF-Pro-Text-Regular.otf") format("opentype");
}
Binary file added public/foton-favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/book-background-desktop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/book-background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/currently-reading.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/discover-background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/discover-foreground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/review-of-the-day.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
145 changes: 145 additions & 0 deletions src/components/CardSwiper/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
import { useState } from 'react'
import Link from 'next/link'
import Image from 'next/image'
import { Swiper, SwiperSlide } from 'swiper/react'
import SwiperCore, { Navigation, Pagination } from "swiper/core";
import "swiper/css";
import { motion } from "framer-motion"
import { Box, Text, Heading, Flex } from '@chakra-ui/react'
import { CardStatisticsIcon } from '../Icons'

SwiperCore.use([Pagination, Navigation]);
const MotionBox = motion(Box)
const MotionFlex = motion(Flex)

export const CardSwiper = ({ books }) => {
const [swiper, setSwiper] = useState(0)

if (!books) {
return null
}

return (
<Flex minHeight='140px' sx={{ ".swiper-wrapper": { alignItems: "center" } }}>
<Swiper
breakpoints={{
base: {
slidesPerView: 1.25
},
800: {
slidesPerView: 3
}
}}
onTransitionEnd={(data) => setSwiper(data.realIndex)}
>
{books.map((book, i) => {
const { id, volumeInfo: { authors, title, imageLinks: { thumbnail } } } = book
const isActive = i === swiper

return (
<SwiperSlide key={id}>
<Link href={`/book/${id}`} passHref>
<MotionBox
as='a'
title={title}
display='flex'
mr='10px'
index={i}
swiper={swiper}
whileTap={{scale: .95}}
>
<MotionFlex
height='128px'
width='250px'
bgColor={isActive ? '#00173d' : '#451475'}
p='16px 20px 20px'
borderRadius='8px'
cursor='pointer'
sx={{
backgroundImage: 'url("/images/discover-background.png")',
backgroundPosition: '0 100%',
backgroundRepeat: 'no-repeat',
img: { borderRadius: '8px' }
}}
animate={{
width: isActive ? '272px' : '250px',
height: isActive ? '140px' : '128px',
img: {
height: isActive ? '112px' : '110px'
},
}}
transition={{ ease: 'linear', duration: .1 }}
>

<Flex
flexDir='column'
display='inline-flex'
justify='space-between'
flex='1'
>
<Box>
<Heading
as='h3'
color='white.100'
fontWeight='bold'
fontSize='28px'
maxWidth={132}
mb='4px'
lineHeight='36px'
letterSpacing='2px'
isTruncated
>
{title}
</Heading>
{authors && authors.slice(0, 1).map(author => (
<Text
key={author}
fontSize='14px'
lineHeight='16px'
letterSpacing='1.3px'
color='white.300'
>
{author}
</Text>
))}
</Box>

<Flex as='span' fontSize='10px' align='center' color='white.300'>
<CardStatisticsIcon boxSize='16px' position='relative' top='3px'/>
<Text color='white.secondary'>
<Text as='span' fontWeight='bold'>120+ </Text>
Read now
</Text>
</Flex>

</Flex>

<Flex flexDir='column' position='relative'>
<Box position='absolute' sx={{ left: '-36px', top: '-11px', }} zIndex='2'>
<Image
width={60}
height={100}
display='block'
src='/images/discover-foreground.png'
/>
</Box>

<Image
width={72}
height={111}
display='block'
alt={title}
src={thumbnail}
/>
</Flex>

</MotionFlex>
</MotionBox>
</Link>
</SwiperSlide>
)
})}
</Swiper>
</Flex>
)
}
80 changes: 80 additions & 0 deletions src/components/CurrentBookCard/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import Image from 'next/image'
import NextLink from 'next/link'
import { Flex, Text, Box } from '@chakra-ui/react'
import { CurrentlyReadingIcon } from '../Icons'

export const CurrentBookCard = ({ book }) => {
const { id, etag, volumeInfo: { authors, title, imageLinks: { thumbnail } } } = book
return (
<NextLink href='#' passHref>
<Flex
as='a'
position='relative'
p='10px 20px 10px 20px'
mt='20px'
maxWidth='330px'
maxHeight='100px'
background='#eef5db'
boxShadow='0px 3px 45px rgba(121, 141, 67, 0.115084)'
borderRadius='0px 3px 3px 0px'
cursor='pointer'
sx={{ gap: '8px' }}
>

<Flex flexDir='column' justify='space-between' mr='10px'>
<Box m='-25px 0' maxHeight='130px'>
<Image
width={88}
height={130}
src={thumbnail}
/>
</Box>
</Flex>

<Flex flexDir='column' justify='space-between' flex='1'>
<Box>
<Text as='h3' fontWeight='700' fontSize='20px' lineHeight='26px' color='title.700'>{title}</Text>
{authors && authors.slice(0, 1).map(author => (
<Text
key={author}
fontSize='10px'
color='text.800'
>
by {author}
</Text>
))}
</Box>

<Flex align='center' color='title.700'>
<CurrentlyReadingIcon boxSize='16px' position='relative' top='2px' />
<Text>
Chapter&nbsp;
<Text as='span' color='highlight'>2&nbsp;</Text>
From 9
</Text>
</Flex>
</Flex>

<Flex
flexDir='column'
justify='space-between'
position='absolute'
top='0'
right='0'
width='100%'
height='100px'
overflow='hidden'
>
<Box position='absolute' top='-20px' right='-33px' zIndex='1'>
<Image
width={142}
height={157}
src='/images/currently-reading.png'
/>
</Box>
</Flex>

</Flex>
</NextLink>
)
}
Loading