-
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
Arunkumar
authored and
Arunkumar
committed
Sep 29, 2020
1 parent
73a4a1f
commit 8651433
Showing
12 changed files
with
8,035 additions
and
230 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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 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 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 * as React from "react"; | ||
import { useInView } from "react-intersection-observer"; | ||
|
||
export const Page = (props) => { | ||
const { ref, inView } = useInView({ | ||
threshold: 0, | ||
}); | ||
const className = 'Pages'; | ||
return ( | ||
<ul key={props.id} ref={ref} className={className}> | ||
{inView && props.items} | ||
{!inView && <div style={{ height: "1000px" }}> </div>} | ||
</ul> | ||
); | ||
} |
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,42 @@ | ||
|
||
import * as React from "react"; | ||
import { Image } from "../image"; | ||
import { Page } from './Page'; | ||
|
||
const MAX_IMAGES_PER_PAGE = 20; | ||
|
||
export const PageList = (props) => { | ||
const renderImageList = (images) => { | ||
const pages = []; | ||
if (images.length < MAX_IMAGES_PER_PAGE) { | ||
const page = images.map((image, index) => { | ||
return <Image {...image} key={index} />; | ||
}); | ||
return <Page items={page} id={0} key={0} />; | ||
} | ||
|
||
let count = 0; | ||
let id = 0; | ||
let list = []; | ||
for (let index = 0; index < images.length; index++) { | ||
const image = images[index]; | ||
const imageEl = <Image {...image} key={index} />; | ||
list.push(imageEl); | ||
count++; | ||
if (count === MAX_IMAGES_PER_PAGE) { | ||
const p = <Page items={list} id={id} key={id} />; | ||
id++; | ||
pages.push(p); | ||
count = 0; | ||
list = []; | ||
} | ||
} | ||
return pages; | ||
}; | ||
|
||
return ( | ||
<> | ||
{renderImageList(props.images)} | ||
</> | ||
); | ||
} |
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 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,45 @@ | ||
import * as React from "react"; | ||
import { useInView } from "react-intersection-observer"; | ||
interface Props { | ||
url: string; | ||
} | ||
|
||
const placeHoledrImage = | ||
"https://media.giphy.com/media/l0dJ49ChzUuKU8Ampv/giphy.gif"; | ||
|
||
export const Image: React.FC<Props> = React.memo((props) => { | ||
let observer = null; | ||
let element = null; | ||
React.useEffect(() => { | ||
observer = new IntersectionObserver( | ||
(entries) => { | ||
entries && | ||
entries.forEach((entry) => { | ||
const { isIntersecting } = entry; | ||
if (isIntersecting && element) { | ||
element.src = props.url; | ||
} else { | ||
if (element) { | ||
element.src = placeHoledrImage; | ||
} | ||
} | ||
}); | ||
}, | ||
{ | ||
root: window.document.body, | ||
rootMargin: "0px 0px 200px 0px", | ||
} | ||
); | ||
observer.observe(element); | ||
return () => (observer = observer.disconnect()); | ||
}, []); | ||
|
||
return ( | ||
<li> | ||
<img | ||
ref={(el) => (element = el)} | ||
src={placeHoledrImage} | ||
/> | ||
</li> | ||
); | ||
}); |
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,123 +1,48 @@ | ||
.ImageContiner { | ||
display: flex; | ||
justify-content: center; | ||
/* http://meyerweb.com/eric/tools/css/reset/ | ||
v2.0 | 20110126 | ||
License: none (public domain) | ||
*/ | ||
|
||
html, body, div, span, applet, object, iframe, | ||
h1, h2, h3, h4, h5, h6, p, blockquote, pre, | ||
a, abbr, acronym, address, big, cite, code, | ||
del, dfn, em, img, ins, kbd, q, s, samp, | ||
small, strike, strong, sub, sup, tt, var, | ||
b, u, i, center, | ||
dl, dt, dd, ol, ul, li, | ||
fieldset, form, label, legend, | ||
table, caption, tbody, tfoot, thead, tr, th, td, | ||
article, aside, canvas, details, embed, | ||
figure, figcaption, footer, header, hgroup, | ||
menu, nav, output, ruby, section, summary, | ||
time, mark, audio, video { | ||
margin: 0; | ||
padding: 0; | ||
border: 0; | ||
font-size: 100%; | ||
font: inherit; | ||
vertical-align: baseline; | ||
} | ||
/* HTML5 display-role reset for older browsers */ | ||
article, aside, details, figcaption, figure, | ||
footer, header, hgroup, menu, nav, section { | ||
display: block; | ||
} | ||
|
||
img { | ||
height: 250px; | ||
width: 350px; | ||
margin: 5px; | ||
border-radius: 10px; | ||
} | ||
|
||
body { | ||
background: aliceblue; | ||
line-height: 1; | ||
} | ||
|
||
@media only screen and (max-width: 600px) { | ||
|
||
|
||
.InfinitRender { | ||
width: 100%; | ||
margin: 5px; | ||
} | ||
|
||
img { | ||
height: 350px; | ||
width: 100%; | ||
margin: 5px; | ||
border-radius: 10px; | ||
} | ||
|
||
.InfinitRender__continer { | ||
display: grid; | ||
grid-template-columns: repeat(1, 1fr); | ||
grid-gap: 5px; | ||
} | ||
|
||
ol, ul { | ||
list-style: none; | ||
} | ||
|
||
@media only screen and (min-width: 600px) { | ||
|
||
.InfinitRender { | ||
width: 100%; | ||
margin: 5px; | ||
} | ||
|
||
img { | ||
height: 350px; | ||
width: 100%; | ||
margin: 5px; | ||
border-radius: 10px; | ||
} | ||
|
||
.InfinitRender__continer { | ||
display: grid; | ||
grid-template-columns: repeat(2, 1fr); | ||
grid-gap: 5px; | ||
} | ||
|
||
blockquote, q { | ||
quotes: none; | ||
} | ||
|
||
@media only screen and (min-width: 768px) { | ||
|
||
.InfinitRender { | ||
width: 100%; | ||
margin: 5px; | ||
} | ||
|
||
img { | ||
height: 350px; | ||
width: 100%; | ||
margin: 5px; | ||
border-radius: 10px; | ||
} | ||
|
||
.InfinitRender__continer { | ||
display: grid; | ||
grid-template-columns: repeat(3, 1fr); | ||
grid-gap: 5px; | ||
} | ||
|
||
} | ||
|
||
|
||
@media only screen and (min-width: 1200px) { | ||
|
||
.InfinitRender { | ||
width: 100%; | ||
margin: 5px; | ||
} | ||
|
||
img { | ||
height: 350px; | ||
width: 100%; | ||
margin: 5px; | ||
border-radius: 10px; | ||
} | ||
|
||
.InfinitRender__continer { | ||
display: grid; | ||
grid-template-columns: repeat(4, 1fr); | ||
grid-gap: 5px; | ||
} | ||
|
||
} | ||
|
||
.loader { | ||
display: flex; | ||
margin: auto; | ||
} | ||
|
||
.img-hover-zoom { | ||
height: 360px; | ||
overflow: hidden; | ||
} | ||
|
||
.img-hover-zoom img { | ||
transition: transform .9s ease; | ||
blockquote:before, blockquote:after, | ||
q:before, q:after { | ||
content: ''; | ||
content: none; | ||
} | ||
|
||
.img-hover-zoom:hover img { | ||
transform: scale(1.1); | ||
table { | ||
border-collapse: collapse; | ||
border-spacing: 0; | ||
} |
Oops, something went wrong.