Skip to content

Commit

Permalink
Merge pull request #50 from bodrovphone/zadelis-components
Browse files Browse the repository at this point in the history
refactor with next/img
  • Loading branch information
bodrovphone authored Jun 17, 2021
2 parents 6c87c6c + 1306e55 commit f6b95da
Show file tree
Hide file tree
Showing 11 changed files with 106 additions and 41 deletions.
22 changes: 16 additions & 6 deletions components/aboutZadelis/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from "react";
import { About_ST, Content_ST, Social_ST } from "./styles";
import Logo from "../logo";
import Image from "next/image";

const AboutZadelis = () => (
<About_ST>
Expand All @@ -21,29 +22,38 @@ const AboutZadelis = () => (
rel="external"
href="https://www.instagram.com/explore/tags/zadelis/"
>
<img
src="../img/instagram-logo.png"
<Image
src="/img/instagram-logo.png"
alt="Facebook Logo"
className="image"
width={42}
height={42}
/>
</a>
<a
target="_blank"
rel="external"
href="https://www.facebook.com/hashtag/zadelis"
>
<img
src="../img/facebook-logo.png"
<Image
src="/img/facebook-logo.png"
alt="Instagram Logo"
className="image"
width={42}
height={42}
/>
</a>
<a
target="_blank"
rel="external"
href="https://twitter.com/hashtag/zadelis"
>
<img
src="../img/twitter-logo.png"
<Image
src="/img/twitter-logo.png"
alt="Twitter Logo"
className="image"
width={42}
height={42}
/>
</a>
</Social_ST>
Expand Down
7 changes: 2 additions & 5 deletions components/aboutZadelis/styles/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ export const Social_ST = styled.div`
margin: 20px auto;
text-align: center;
img {
width: 48px;
height: 48px;
background-color: transparent;
margin-left: 10px;
a {
margin-right: 10px;
}
`;
3 changes: 1 addition & 2 deletions components/blog/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,10 @@ const Recommendations = (recommended) => {

const Blog = ({ data }) =>
data.blocks.map(({ text, image, recommended }, index) => (
<ST.Blog>
<ST.Blog key={index}>
{ReactHtmlParser(text)}
{image && (
<Image
key={index}
src={image}
alt="Picture of money"
width={650}
Expand Down
4 changes: 2 additions & 2 deletions components/categoriesWidget/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ const CategoriesWidget = ({ categories }) => (
{categories.map((cat, index) => (
<Image_ST key={index}>
<GifPlayer
gif={`img/categories/${cat}.gif`}
still={`img/categories/${cat}.png`}
gif={`/img/categories/${cat}.gif`}
still={`/img/categories/${cat}.png`}
/>
<span>{translate[cat]["ru"]}</span>
</Image_ST>
Expand Down
15 changes: 13 additions & 2 deletions components/footer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from "react";
import { Footer_ST, Grid_ST, GridBlock_ST, GridItem_ST } from "./styles";
import GridItem from "./gridItem";
import { Envelope } from "react-bootstrap-icons";
import Image from "next/image";

const Footer = () => (
<Footer_ST>
Expand Down Expand Up @@ -36,10 +37,20 @@ const Footer = () => (
<Envelope size={32} color="black" />
</a>
<a href="viber://add?number=12345678">
<img src="img/viber-logo.svg" />
<Image
src="/img/viber-logo.svg"
alt="Picture of viber messanger"
width={32}
height={32}
/>
</a>
<a href="https://telegram.me/YourUsernameHere">
<img src="img/telegram-logo.svg" />
<Image
src="/img/telegram-logo.svg"
alt="Picture of viber messanger"
width={32}
height={32}
/>
</a>
</div>
</address>
Expand Down
36 changes: 30 additions & 6 deletions components/getSocial/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,36 @@
import React from 'react';
import { Wrapper } from './styles';
import React from "react";
import { Wrapper } from "./styles";
import Image from "next/image";

const GetSocial = (props) => (
<Wrapper>
<img src="../img/getSocial/getSocial-bycicle.jpg" />
<img src="../img/getSocial/getSocial-worker.jpg" />
<img src="../img/getSocial/getSocial-kayak.jpg" />
<img src="../img/getSocial/getSocial-suit.jpg" />
<Image
src="/img/getSocial/getSocial-bycicle.jpg"
alt="picture of bycicle"
width="100%"
height="100%"
layout="responsive"
/>
<Image
src="/img/getSocial/getSocial-worker.jpg"
alt="picture of bycicle"
width="100%"
height="100%"
/>
<Image
src="/img/getSocial/getSocial-kayak.jpg"
alt="picture of bycicle"
width="100%"
height="100%"
layout="responsive"
/>
<Image
src="/img/getSocial/getSocial-suit.jpg"
alt="picture of bycicle"
width="100%"
height="100%"
layout="responsive"
/>
</Wrapper>
);

Expand Down
11 changes: 7 additions & 4 deletions components/getSocial/styles/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,21 @@ import { device } from "../../styles/media";
export const Wrapper = styled.div`
width: 100%;
display: flex;
justify-content: space-around;
justify-content: center;
flex-wrap: wrap;
gap: 10px;
img {
& > div {
width: 45%;
margin: 10px 0;
height: auto;
max-height: 180px;
}
@media ${device.mobileXL} {
img {
justify-content: space-around;
& > div {
width: 23%;
}
}
Expand Down
23 changes: 15 additions & 8 deletions components/gifPlayer/gifPlayer.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,29 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import React from "react";
import PropTypes from "prop-types";
import classNames from "classnames";
import Image from "next/image";

const GifPlayer = ({ gif, still, playing, toggle, ...rest }) => (
<div
className={classNames('gif_player', { 'playing': playing })}
onMouseEnter={toggle} onMouseLeave={toggle}
className={classNames("gif_player", { playing: playing })}
onMouseEnter={toggle}
onMouseLeave={toggle}
>
<div className="play_button" />
<img {...rest} src={playing ? (gif || still) : (still || gif)} />
<Image
width={75}
height={75}
{...rest}
src={playing ? gif || still : still || gif}
/>
</div>
);

GifPlayer.propTypes = {
gif: PropTypes.string,
still: PropTypes.string,
playing: PropTypes.bool,
toggle: PropTypes.func
toggle: PropTypes.func,
};

export default GifPlayer;
export default GifPlayer;
9 changes: 8 additions & 1 deletion components/singleCard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from "react";
import Link from "next/link";
import PropTypes from "prop-types";
import { GeoAlt, Cash, Bookmarks, BookmarksFill } from "react-bootstrap-icons";
import Image from "next/image";

import { CardWrapper, CardDetails, CardImage, CardTitle } from "./styles";

Expand Down Expand Up @@ -37,7 +38,13 @@ const SingleCard = ({ id, imageSrc, title, details }) => {
<Link href={`/prokat/${id}`}>
<a>
<CardImage>
<img src={imageSrc}></img>
<Image
src="/img/sample_product_image.webp"
width="100%"
height="100%"
layout="responsive"
priotiy={true}
/>
</CardImage>
<CardTitle>{title}</CardTitle>
<CardDetails>
Expand Down
17 changes: 12 additions & 5 deletions pages/prokat/[id].js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useRouter } from "next/router";
import Image from "next/image";

import Layout, {
Main,
Expand Down Expand Up @@ -45,13 +46,19 @@ const Prokat = (props) => {
<ProkatDescription description="Прекрасный проектор для просмотра фильмов с друзъями. Предлогаем разные модели. Простой в управлении. 4k качество ктор для просмотра фильмов с друзъями. Предлогактор для просмотра фильмов с друзъями. Прекрасный проектор для просмотра фильмов с друзъями. Предлогаем разные модели. Простой в управлении. 4k качество ктор для просмотра фильмов с друзъями. Предлогактор для просмотра фильмов с друзъями." />

<ContactOwnerWrapper>
<img src="../img/chat.png" />
<img src="../img/call.png" />
<img
<Image src="/img/chat.png" width={75} height={75} />
<Image src="/img/call.png" width={75} height={75} />
<Image
styles={{ fill: "red" }}
src="../img/viber-icon-colored.svg"
src="/img/viber-icon-colored.svg"
width={75}
height={75}
/>
<Image
src="/img/telegram-icon-colored.svg"
width={75}
height={75}
/>
<img src="../img/telegram-icon-colored.svg" />
</ContactOwnerWrapper>
</Section_ST>
</TwoColumnsDesktop>
Expand Down
Binary file added public/img/sample_product_image.webp
Binary file not shown.

1 comment on commit f6b95da

@vercel
Copy link

@vercel vercel bot commented on f6b95da Jun 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.