-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
083abd7
commit f1b6b0a
Showing
25 changed files
with
925 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,13 @@ | ||
{ | ||
"presets": ["next/babel"], | ||
"plugins": [["styled-components", { "ssr": true }]] | ||
} | ||
"presets": [ | ||
"next/babel" | ||
], | ||
"plugins": [ | ||
[ | ||
"styled-components", | ||
{ | ||
"ssr": true | ||
} | ||
] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
NEXT_PUBLIC_UNSPLASH_API_KEY=_-11Cu6zCehO-IGPcUHSAdOzOezV_9k0ZukKWPneV3Q |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
reactStrictMode: true, | ||
|
||
images: { | ||
domains: ["images.unsplash.com"], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import { useEffect, useState } from 'react'; | ||
import Image from 'next/image'; | ||
import Router from 'next/router' | ||
|
||
import Carousel from "react-elastic-carousel"; | ||
|
||
import { CarouselPerfilStyle } from "./styles"; | ||
import api from '@/service/api'; | ||
import React from 'react'; | ||
import { toast } from 'react-toastify'; | ||
|
||
import { UserCarousel } from '@/interface' | ||
import { CardContent, Typography } from '@material-ui/core'; | ||
import { CardUserCarousel } from '@/styles/MaterialGuide/' | ||
|
||
|
||
export default function CarouselPerfil() { | ||
const [userCarousel, setUserCarousel] = useState<any[]>([]); | ||
|
||
useEffect(() => { | ||
function fetchApiUnsplash() { | ||
api.get('search/users?', { | ||
params: { | ||
query: 'usa', | ||
client_id: process.env.NEXT_PUBLIC_UNSPLASH_API_KEY | ||
} | ||
}).then((response: any) => setUserCarousel(response.data.results) | ||
).catch(error => toast.warning(error.message)); | ||
} | ||
fetchApiUnsplash(); | ||
}, []) | ||
|
||
const handleRedirectUserPerfil = (username: string) => () => { | ||
Router.push(`/users/${username}`) | ||
} | ||
|
||
return ( | ||
<CarouselPerfilStyle> | ||
<Carousel | ||
showArrows={false} | ||
isRTL | ||
itemPadding={[0, 5]} | ||
breakPoints={ | ||
[ | ||
{ width: 1, itemsToShow: 5 }, | ||
{ width: 550, itemsToShow: 6 }, | ||
{ width: 768, itemsToShow: 8 }, | ||
{ width: 1200, itemsToShow: 12 }, | ||
] | ||
} | ||
> | ||
{userCarousel.map((item: UserCarousel, index: number) => ( | ||
<CardUserCarousel | ||
key={index} | ||
onClick={handleRedirectUserPerfil(item.username)} | ||
> | ||
<div className="profile-picture"> | ||
<Image src={item.profile_image?.medium} alt={`Profile picture of ${item.name}`} width={56} height={56} /> | ||
</div> | ||
<CardContent> | ||
<Typography variant="h2" component="p"> | ||
{item.name} | ||
</Typography> | ||
</CardContent> | ||
</CardUserCarousel> | ||
))} | ||
</Carousel> | ||
</CarouselPerfilStyle > | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import styled from "styled-components"; | ||
|
||
export const CarouselPerfilStyle = styled.div` | ||
width: 100%; | ||
height: 100px; | ||
a { | ||
text-decoration: none; | ||
cursor: pointer; | ||
} | ||
.rec { | ||
margin-top: 0; | ||
} | ||
.rec-dot { | ||
box-shadow: none; | ||
border: none; | ||
background: none; | ||
box-shadow: none; | ||
} | ||
.rec-item-wrapper { | ||
width: 80px; | ||
} | ||
.MuiTypography-h2 { | ||
color: #262626; | ||
font-size: 12px; | ||
line-height: 16px; | ||
overflow: hidden; | ||
text-align: center; | ||
text-overflow: ellipsis; | ||
white-space: nowrap; | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import Link from 'next/link'; | ||
import Image from 'next/image'; | ||
|
||
import { HeaderStyled } from './styles'; | ||
|
||
export default function Header() { | ||
return ( | ||
<HeaderStyled> | ||
<Link href="/"> | ||
<a target="_self"> | ||
<Image src="/image/mobile-nav.png" alt="instagram brand icon" | ||
width={103} height={29} /> | ||
</a> | ||
</Link> | ||
</HeaderStyled> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import theme from "@/styles/theme"; | ||
import styled from "styled-components"; | ||
|
||
export const HeaderStyled = styled.div` | ||
width: 414px; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
background: ${theme.palette.background.default}; | ||
border-bottom: 1px solid ${theme.palette.text.disabled}; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
export interface UserInstagram { | ||
instagram_username: string; | ||
name: string; | ||
bio: string; | ||
location: string; | ||
links: Array<string>; | ||
profile_image: Array<string>; | ||
following_count: number; | ||
followers_count: number; | ||
total_photos: number; | ||
} | ||
export interface UserPhotosData { | ||
photos: Array<string>; | ||
} | ||
|
||
export interface UserCarousel { | ||
username: string; | ||
id: string; | ||
name: string; | ||
profile_image: any; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import React from 'react'; | ||
import Document, { DocumentContext, Html, Head, Main, NextScript } from 'next/document'; | ||
import { ServerStyleSheets } from '@material-ui/styles'; | ||
import { ServerStyleSheet } from 'styled-components'; | ||
|
||
class MyDocument extends Document { | ||
render() { | ||
return ( | ||
<Html lang="pt"> | ||
<Head> | ||
|
||
<meta charSet="UTF-8" /> | ||
|
||
<link | ||
href="https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap" | ||
rel="stylesheet" | ||
/> | ||
<link | ||
rel="shortcut icon" | ||
href="/image/shortcut-icon.jpg" | ||
type="image/x-icon" | ||
/> | ||
|
||
</Head> | ||
<body> | ||
<Main /> | ||
<NextScript /> | ||
</body> | ||
</Html> | ||
); | ||
} | ||
} | ||
|
||
MyDocument.getInitialProps = async (ctx: DocumentContext) => { | ||
|
||
const materialSheet = new ServerStyleSheets(); | ||
const styledComponentSheet = new ServerStyleSheet(); | ||
const originalRenderPage = ctx.renderPage; | ||
|
||
try { | ||
ctx.renderPage = () => | ||
originalRenderPage({ | ||
enhanceApp: (App) => (props) => | ||
styledComponentSheet.collectStyles( | ||
materialSheet.collect(<App {...props} />), | ||
), | ||
}); | ||
|
||
const initialProps = await Document.getInitialProps(ctx); | ||
|
||
return { | ||
...initialProps, | ||
styles: [ | ||
...React.Children.toArray(initialProps.styles), | ||
materialSheet.getStyleElement(), | ||
styledComponentSheet.getStyleElement(), | ||
], | ||
}; | ||
} finally { | ||
styledComponentSheet.seal(); | ||
} | ||
}; | ||
|
||
export default MyDocument; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { HomeStyled } from '@/styles/pages/home'; | ||
|
||
import CarouselPerfil from '@/components/CarouselPerfil'; | ||
import Header from '@/components/Header'; | ||
|
||
export default function Home() { | ||
return ( | ||
<HomeStyled> | ||
<Header /> | ||
|
||
<div className="home-carousel-content"> | ||
<CarouselPerfil /> | ||
</div> | ||
</HomeStyled> | ||
) | ||
} |
Oops, something went wrong.