Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove unnecessary params being passed to amp-carousel #220

Merged
merged 3 commits into from
Jun 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [1.5.0](https://github.com/quintype/quintype-amp/compare/v1.5.0-amp-carousel-bugfix.0...v1.5.0) (2020-06-30)

## [1.4.0](https://github.com/quintype/quintype-amp/compare/v1.0.25...v1.4.0) (2020-06-26)


Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@quintype/amp",
"version": "1.4.0",
"version": "1.5.0",
"description": "Quintype's AMP component library for publisher apps to create amp layouts",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
91 changes: 91 additions & 0 deletions src/__fixtures__/all-element-story.fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,97 @@ const allElementsStory = {
text:
"<p>In general—and this is a good P.S.A. reminder for everyone—if you are symptomatic, you are supposed to stay home for seven days, or three days past whenever your symptoms resolve, whichever one of those is longest. [If you have been in close contact with a person who has tested positive and you are asymptomatic, experts recommend staying home for fourteen days after that contact.] If I don’t get tested, I’ll stay home for seven days. But if I do get tested and I test negative, I could go back.</p>"
},
{
description: "",
"page-url": "/story/af018d6b-2166-4344-b167-40405a148e41/element/a50b2136-c18b-4dd9-a2b2-0df96e2c253a",
type: "composite",
"family-id": "88e7df74-fe20-42ad-b5aa-54de86108fc4",
"story-elements": [
{
description: "",
"image-metadata": {
width: 656,
height: 280
},
type: "image",
"family-id": "fae56324-4c23-45b7-baac-81da10ae5ff6",
"image-attribution": "Attribution of an imitation game",
title: "Chase: An Imitation Game - A Story On Dharavi's Fake Leather Bags",
id: "5c375339-5fb0-481a-a811-ae271d894b3b",
"image-s3-key":
"ace/2020-03/ad503d63-4d05-41e6-9722-fdfe3acb2405/handwashing_8_wide_eb1f71948877c7a15d27a82cd7d90b324b956a89.jpg",
metadata: {},
subtype: null
},
{
description: "",
"image-metadata": {
width: 326,
height: 155
},
type: "image",
"family-id": "953a1d2c-d52d-4b13-8af5-969e74813197",
"image-attribution": "Ramsharan Gorur Jayaraman",
title: "Caption",
id: "48b14295-99ed-4fc8-ad99-4cb1d85a29ae",
"image-s3-key": "ace/2019-06/051658dc-43f0-4945-92bd-f2da2a206e40/panda.jpg",
metadata: {},
subtype: null
}
],
title: "",
id: "a50b2136-c18b-4dd9-a2b2-0df96e2c253a",
metadata: {
type: "slideshow"
},
subtype: "image-gallery"
},
{
description: "",
"page-url": "/story/af018d6b-2166-4344-b167-40405a148e41/element/db5dd415-e4e1-41f8-83af-48f771fe22ec",
type: "composite",
"family-id": "015f0be5-428f-47f2-86ff-fba42be6c77b",
"story-elements": [
{
description: "",
"image-metadata": {
width: 1200,
height: 520
},
type: "image",
"family-id": "6532027a-f855-474c-8651-dbdd96de3b39",
"image-attribution": "",
title: "Are college interviews now a saffron litmus test?",
id: "36452445-2155-496a-b471-de48870b713a",
"image-s3-key": "ace/2019-06/051658dc-43f0-4945-92bd-f2da2a206e40/panda.jpg",
metadata: {},
subtype: null
},
{
description: "",
"image-metadata": {
width: 3128,
height: 3910,
"focus-point": [350, 3166]
},
type: "image",
"family-id": "e343544a-93b4-43d8-bc52-2c3a63adeac7",
"image-attribution": "unsplash",
title: "Traffic cones",
id: "0898278c-9fac-4685-a0ae-d9caf8c1e7a7",
"image-s3-key":
"ace/2020-03/ad503d63-4d05-41e6-9722-fdfe3acb2405/handwashing_8_wide_eb1f71948877c7a15d27a82cd7d90b324b956a89.jpg",
metadata: {},
subtype: null
}
],
title: "",
id: "db5dd415-e4e1-41f8-83af-48f771fe22ec",
metadata: {
type: "gallery"
},
subtype: "image-gallery"
},
{
description: "",
"embed-js":
Expand Down
4 changes: 2 additions & 2 deletions src/atoms/carousel/carousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Helmet } from "react-helmet";
import { CarouselTypes } from "./types";
import { LightboxGallery } from "../lightbox-gallery";

export const Carousel = ({ children, ...props }: CarouselTypes) => {
export const Carousel = (props: CarouselTypes) => {
return (
<Fragment>
<Helmet>
Expand All @@ -14,7 +14,7 @@ export const Carousel = ({ children, ...props }: CarouselTypes) => {
/>
</Helmet>
{props.lightbox && <LightboxGallery />}
<amp-carousel {...props}>{children}</amp-carousel>
<amp-carousel {...props} />
Copy link
Contributor

Choose a reason for hiding this comment

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

We are passing <amp-img> as children to <amp-carousel>. Is it fine, if you remove it ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

children is also part of props so <amp-carousel {...props}>{children}</amp-carousel> is same as <amp-carousel {...props} />

Copy link
Contributor

Choose a reason for hiding this comment

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

okay.

</Fragment>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const ImageGalleryElementBase = ({ element, story, config }: StoryElement
return imageGalleryElementRender ? (
imageGalleryElementRender({ story, config, element })
) : (
<DefaultImageGalleryElement element={element} story={story} config={config} />
<DefaultImageGalleryElement element={element} />
);
};

Expand Down
12 changes: 10 additions & 2 deletions src/helpers/ampify-story/ampify-story.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@

import { ampifyStory } from "./ampify-story";
import { isValidAmpHtml } from "../../utils/validate-amp";
import { storyWithManyJsEmbeds, publisherConfig, ampConfig, relatedStories, configOpts, seo } from "../../__fixtures__";
import {
allElementsStory,
storyWithManyJsEmbeds,
publisherConfig,
ampConfig,
relatedStories,
configOpts,
seo
} from "../../__fixtures__";
import { sampleTextStory } from "./sampleTextStory";

describe("Ampify Story with custom opts", () => {
Expand All @@ -27,7 +35,7 @@ describe("Ampify Story with custom opts", () => {

it("ampifyStory function should return valid amp-html", async () => {
const ampHtml = ampifyStory({
story: storyWithManyJsEmbeds,
story: allElementsStory,
publisherConfig,
ampConfig,
opts: configOpts,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

exports[`DateUpdated should match snapshot 1`] = `
<Component
formattedDate="4 months ago"
formattedDate="5 months ago"
prepend="Story Updated:"
/>
`;