Skip to content

Commit

Permalink
Merge pull request #61 from dadoagency/fix/trustpilot-review-b2
Browse files Browse the repository at this point in the history
fix: removed old imports for version 2 of trustpilot review b
  • Loading branch information
martink-rsa committed Jan 7, 2021
2 parents 17f9401 + 505c6bc commit c6fc878
Show file tree
Hide file tree
Showing 114 changed files with 12,671 additions and 8 deletions.
4 changes: 4 additions & 0 deletions .yalc/@dadoagency/contentful-gatsby-components/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
// "presets": [["babel-preset-gatsby-package", { "browser": true }], "sass-loader"]
"presets": ["@babel/preset-env", "@babel/preset-react"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.cache
package.json
package-lock.json
public
4 changes: 4 additions & 0 deletions .yalc/@dadoagency/contentful-gatsby-components/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"arrowParens": "avoid",
"semi": false
}
1,055 changes: 1,055 additions & 0 deletions .yalc/@dadoagency/contentful-gatsby-components/CHANGELOG.md

Large diffs are not rendered by default.

48 changes: 48 additions & 0 deletions .yalc/@dadoagency/contentful-gatsby-components/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
Storybook: https://master--5f43c1219b70f800227245f3.chromatic.com

Chromatic: https://chromatic.com/library?appId=5f43c1219b70f800227245f3&branch=master

## How to install

`yarn add @dadoagency/contentful-gatsby-components`

### Edit gatsby config

**IMPORTANT:**

You need to specify the a URL in the Trustpilot compliance metadata otherwise the project will not build.

```
siteMetadata: {
...,
compliance: {
trustpilot: "https://www.trustpilot.com/review/thepetlabco.com",
},
},
```

add to the plugins list:

```
module.exports = {
...
plugins: [
`@dadoagency/contentful-gatsby-components`,
]
}
```

## How to develop

```
yarn
yarn link
```

### TODO:

---

- [ ] tp widgets
- [ ] write tests
- [ ] fix errors
20 changes: 20 additions & 0 deletions .yalc/@dadoagency/contentful-gatsby-components/gatsby-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const path = require(`path`)

module.exports = {
plugins: [
{
resolve: `gatsby-source-filesystem`,
options: {
name: `images`,
path: path.join(__dirname, "src", `images`),
},
},
`gatsby-plugin-sharp`,
`gatsby-transformer-sharp`,
],
siteMetadata: {
compliance: {
trustpilot: "https://www.trustpilot.com/",
},
},
}
196 changes: 196 additions & 0 deletions .yalc/@dadoagency/contentful-gatsby-components/gatsby-node.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
exports.createSchemaCustomization = ({ actions, schema }) => {
const { createTypes } = actions
const typeDefs = [
//productLinkButton
require("./src/schema/productLinkButton/productLinkButton"),

require("./src/schema/advertorialType1"),

require("./src/schema/redirectDestination/redirectDestination"),

//advertorial type 2 headline rich text
require("./src/schema/advertorialType2/headline"),
// advertorialType2 body rich text
require("./src/schema/advertorialType2/body"),
// advertorialType2 footer rich text
require("./src/schema/advertorialType2/footer"),
require("./src/schema/advertorialType2"),

schema.buildObjectType({
name: "Sys",
fields: {
id: "String",
spaceId: "String",
environmentId: "String",
},
}),
schema.buildObjectType({
name: "Entry",
fields: {
sys: "Sys",
},
}),

// ContentfulTrustpilotReview
require("./src/schema/reviews/trustpilot/trustpilotReview"),
schema.buildObjectType({
name: "ContentfulTrustpilotReview",
infer: true,
fields: {
productLinkButton: {
type: "ContentfulProductLinkButton",
extensions: {
infer: true,
link: { by: "id", from: "productLinkButton___NODE" },
},
},
title: "String!",
body: {
type: "contentfulTrustpilotReviewBodyRichTextNode",
extensions: {
link: { by: "id", from: "body___NODE" },
},
},
},
interfaces: ["Node"],
}),
// ContentfulTrustpilotReviewB
require("./src/schema/reviews/trustpilot/trustpilotReviewB"),
schema.buildObjectType({
name: "ContentfulTrustpilotReviewB",
interfaces: ["Node"],
fields: {
title: "String!",
body: {
type: "contentfulTrustpilotReviewBBodyRichTextNode",
extensions: {
link: {
by: "id",
from: "body___NODE",
},
},
},
},
}),
// ContentfulTrustpilotReviewC
require("./src/schema/reviews/trustpilot/trustpilotReviewC"),
schema.buildObjectType({
name: "ContentfulTrustpilotReviewC",
infer: true,
fields: {
productLinkButton: {
type: "ContentfulProductLinkButton",
extensions: {
infer: true,
link: { by: "id", from: "productLinkButton___NODE" },
},
},
title: "String!",
body: {
type: "contentfulTrustpilotReviewCBodyRichTextNode",
extensions: {
link: { by: "id", from: "body___NODE" },
},
},
},
interfaces: ["Node"],
}),
// ContentfulTrustpilotReviewD
require("./src/schema/reviews/trustpilot/trustpilotReviewD"),
schema.buildObjectType({
name: "ContentfulTrustpilotReviewD",
infer: true,
fields: {
productLinkButton: {
type: "ContentfulProductLinkButton",
extensions: {
infer: true,
link: { by: "id", from: "productLinkButton___NODE" },
},
},
title: "String!",
body: {
type: "contentfulTrustpilotReviewDBodyRichTextNode",
extensions: {
link: { by: "id", from: "body___NODE" },
},
},
},
interfaces: ["Node"],
}),
// ContentfulFacebookReview
require("./src/schema/reviews/facebook/facebookReview"),
schema.buildObjectType({
name: "ContentfulFacebookReview",
interfaces: ["Node"],
fields: {
title: "String!",
body: {
type: "contentfulFacebookReviewBodyRichTextNode",
extensions: {
link: {
by: "id",
from: "body___NODE",
},
},
},
productLinkButton: "ContentfulProductLinkButton",
},
}),
// ContentfulFacebookReviewD
require("./src/schema/reviews/facebook/facebookReviewD"),
schema.buildObjectType({
name: "ContentfulFacebookReviewD",
interfaces: ["Node"],
fields: {
title: "String!",
body: {
type: "contentfulFacebookReviewDBodyRichTextNode",
extensions: {
link: {
by: "id",
from: "body___NODE",
},
},
},
productLinkButton: "ContentfulProductLinkButton",
},
}),

schema.buildUnionType({
name: "TestimonialReview",
infer: true,
types: [
"ContentfulFacebookReview",
"ContentfulFacebookReviewD",
"ContentfulTrustpilotReview",
"ContentfulTrustpilotReviewB",
"ContentfulTrustpilotReviewC",
"ContentfulTrustpilotReviewD",
],
}),
`
type ContentfulTestimonialSection implements Node {
reviews: [TestimonialReview] @link(by: "id", from: "reviews___NODE")
}
`,
require("./src/schema/contentful/schema"),
schema.buildObjectType({
name: "Asset",
fields: {
sys: "Sys",
file: "File",
},
interfaces: ["Node"],
}),
schema.buildObjectType({
name: "SocialMediaIcon",
fields: {
link: "String",
icon: "Asset",
},
interfaces: ["Node"],
}),
]
createTypes(typeDefs)
}
41 changes: 41 additions & 0 deletions .yalc/@dadoagency/contentful-gatsby-components/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//components
import Layout from "./src/components/Layout"
import Article from "./src/components/Article"
import TestimonialSection from "./src/components/TestimonialSection"
import DynamicReviewList from "./src/components/Reviews/ReviewList"
import Tracking from "./src/components/Tracking"
import Pixel from "./src/components/Tracking/Pixel"
import ProductCard from "./src/components/ProductCard"
import ProductLinkButton from "./src/components/ProductLinkButton"
import TrustpilotReview from "./src/components/Reviews/Trustpilot/index"
import TrustpilotReviewB from "./src/components/Reviews/Trustpilot/TrustpilotReviewB"
import TrustpilotReviewC from "./src/components/Reviews/Trustpilot/TrustpilotReviewC"

//util
import renderOptions from "./src/utils/richText"
//templates
import AdvertorialType1 from "./src/templates/AdvertorialType1"
import AdvertorialType2 from "./src/templates/AdvertorialType2"
import AdvertorialType3 from "./src/templates/AdvertorialType3"

const RichText = {
renderOptions,
}

export {
Layout,
Article,
TestimonialSection,
RichText,
DynamicReviewList,
AdvertorialType1,
Tracking,
Pixel,
ProductCard,
ProductLinkButton,
AdvertorialType2,
TrustpilotReview,
TrustpilotReviewB,
TrustpilotReviewC,
AdvertorialType3,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const babelOptions = {
presets: ["babel-preset-gatsby"],
}

module.exports = require("babel-jest").createTransformer(babelOptions)
17 changes: 17 additions & 0 deletions .yalc/@dadoagency/contentful-gatsby-components/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module.exports = {
transform: {
"^.+\\.jsx?$": `<rootDir>/jest-preprocess.js`,
},
moduleNameMapper: {
".+\\.(css|styl|less|sass|scss)$": `identity-obj-proxy`,
".+\\.(gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": `<rootDir>/__mocks__/file-mock.js`,
".+\\.(jpg|jpeg|png)$": `<rootDir>/__mocks__/image-mock.js`,
},
testPathIgnorePatterns: [`node_modules`, `\\.cache`, `<rootDir>.*/public`],
transformIgnorePatterns: [`node_modules/(?!(gatsby)/)`],
globals: {
__PATH_PREFIX__: ``,
},
testURL: `http://localhost`,
setupFiles: [`<rootDir>/loadershim.js`],
}
12 changes: 12 additions & 0 deletions .yalc/@dadoagency/contentful-gatsby-components/loadershim.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
global.___loader = {
enqueue: jest.fn(),
}
window.matchMedia =
window.matchMedia ||
function () {
return {
matches: false,
addListener: function () {},
removeListener: function () {},
}
}

0 comments on commit c6fc878

Please sign in to comment.