Skip to content
This repository has been archived by the owner on Jul 14, 2022. It is now read-only.

Commit

Permalink
Merge pull request #198 from mirumee/new_nophoto_image
Browse files Browse the repository at this point in the history
New nophoto image
  • Loading branch information
maarcingebala authored Jan 9, 2019
2 parents 71fe50a + 17574ed commit 65fc6bb
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ Fix two line titles breaking featured carousel, product page improvements #184 b
Allow numbers in product, category & collection urls #185 by @piotrgrundas
Add OpenGraph and Meta tags, minor UI improvements #191 by @piotrgrundas
Add tslint check in the CI, ability to change cart quantity, fix error after removing item from the cart #194 by @piotrgrundas
Update nophoto image #198 by @piotrgrundas
4 changes: 3 additions & 1 deletion src/components/Breadcrumbs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ export const extractBreadcrumbs = (category: Category_category) => {
let breadcrumbs = [constructLink(category)];

if (category.ancestors.edges.length) {
const ancestorsList = category.ancestors.edges.map(constructLink);
const ancestorsList = category.ancestors.edges.map(edge =>
constructLink(edge.node)
);
breadcrumbs = ancestorsList.concat(breadcrumbs);
}
return breadcrumbs;
Expand Down
4 changes: 2 additions & 2 deletions src/components/CachedImage/CachedThumbnail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as React from "react";
import { maybe } from "../../core/utils";
import CachedImage from "./CachedImage";

const noPhotoPng = require("../../images/nophoto.png");
const noPhoto = require("../../images/no-photo.svg");

const CachedThumbnail: React.SFC<{
source: {
Expand All @@ -13,7 +13,7 @@ const CachedThumbnail: React.SFC<{
noPhotoDefault?: boolean;
children?: React.ReactNode;
}> = ({ source, noPhotoDefault, children }) => {
const defaultImg = noPhotoDefault ? noPhotoPng : undefined;
const defaultImg = noPhotoDefault ? noPhoto : undefined;
return (
<CachedImage
url={maybe(() => source.thumbnail.url, defaultImg)}
Expand Down
4 changes: 2 additions & 2 deletions src/components/CartSummary/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as React from "react";
import { maybe } from "../../core/utils";
import { CheckoutContext } from "../CheckoutApp/context";

const noPhotoPng = require("../../images/nophoto.png");
const noPhotoSvg = require("../../images/no-photo.svg");

const CartSummary: React.SFC = () => (
<CheckoutContext.Consumer>
Expand All @@ -18,7 +18,7 @@ const CartSummary: React.SFC = () => (
<img
src={maybe(
() => product.variant.product.thumbnail.url,
noPhotoPng
noPhotoSvg
)}
/>
<div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/ProductListItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as React from "react";
import { CachedThumbnail } from "..";
import { BasicProductFields } from "../../views/Product/types/BasicProductFields";

const noPhoto = require("../../images/nophoto.png");
const noPhoto = require("../../images/no-photo.svg");

export interface Product extends BasicProductFields {
category?: {
Expand Down
16 changes: 16 additions & 0 deletions src/images/no-photo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/images/nophoto.png
Binary file not shown.
9 changes: 7 additions & 2 deletions src/views/Home/Page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import "./scss/index.scss";

import classNames from "classnames";
import * as React from "react";
import { Link } from "react-router-dom";

Expand All @@ -8,6 +9,8 @@ import { ProductsList_categories } from "../../core/types/saleor";
import { generateCategoryUrl } from "../../core/utils";
import { ProductsList_shop_homepageCollection_backgroundImage } from "./types/ProductsList";

const noPhoto = require("../../images/no-photo.svg");

const Page: React.SFC<{
loading: boolean;
categories: ProductsList_categories;
Expand Down Expand Up @@ -61,12 +64,14 @@ const Page: React.SFC<{
key={category.id}
>
<div
className="home-page__categories__list__image"
className={classNames("home-page__categories__list__image", {
"home-page__categories__list__image--no-photo": !category.backgroundImage
})}
style={{
backgroundImage: `url(${
category.backgroundImage
? category.backgroundImage.url
: require("../../images/nophoto.png")
: noPhoto
})`
}}
/>
Expand Down
6 changes: 6 additions & 0 deletions src/views/Home/scss/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@
background-size: cover;
background-position: center;
margin-bottom: 1rem;

&--no-photo {
background-color: $turquoise-light;
background-repeat: no-repeat;
background-size: contain;
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/views/Product/GalleryCarousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as React from "react";
import { CachedImage, Carousel } from "../../components/";
import { ProductDetails_product_images } from "./types/ProductDetails";

const noPhoto = require("../../images/nophoto.png");
const noPhoto = require("../../images/no-photo.svg");

const GalleryCarousel: React.SFC<{
images: ProductDetails_product_images[];
Expand Down
2 changes: 1 addition & 1 deletion src/views/Product/Page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import GalleryCarousel from "./GalleryCarousel";
import OtherProducts from "./Other";
import { ProductDetails_product } from "./types/ProductDetails";

const noPhoto = require("../../images/nophoto.png");
const noPhoto = require("../../images/no-photo.svg");

class Page extends React.PureComponent<{ product: ProductDetails_product }> {
fixedElement: React.RefObject<HTMLDivElement> = React.createRef();
Expand Down

0 comments on commit 65fc6bb

Please sign in to comment.