-
Notifications
You must be signed in to change notification settings - Fork 42
Add: storybook + seo component + gutneberg style package #65
base: master
Are you sure you want to change the base?
Changes from all commits
a79860f
ef03eac
12daa8a
c6ce203
d40c991
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| module.exports = { | ||
| "stories": [ | ||
| "../src/**/*.stories.mdx", | ||
| "../src/**/*.stories.@(js|jsx|ts|tsx)" | ||
| ], | ||
| "addons": [ | ||
| "@storybook/addon-links", | ||
| "@storybook/addon-essentials" | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
|
|
||
| import { MINIMAL_VIEWPORTS } from '@storybook/addon-viewport'; | ||
|
|
||
| export const parameters = { | ||
| actions: { argTypesRegex: "^on[A-Z].*" }, | ||
| viewport: { | ||
| viewports: MINIMAL_VIEWPORTS, | ||
| }, | ||
| } | ||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,74 +1,84 @@ | ||
| { | ||
| "name": "wp-decoupled", | ||
| "version": "1.0.0", | ||
| "description": "A decoupled WordPress application in React built with Next.js", | ||
| "main": "server.js", | ||
| "scripts": { | ||
| "dev": "next dev", | ||
| "dev:inspect": "NODE_OPTIONS='--inspect' next", | ||
| "build": "next build", | ||
| "start": "next start", | ||
| "cypress:open": "cypress open", | ||
| "cypress:run": "cypress run", | ||
| "lint": "eslint --fix .", | ||
| "format": "prettier --write './**/*.{js,jsx,ts,tsx,css,md,json}' --config ./.prettierrc" | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "git+https://github.com/rtCamp/wp-decoupled.git" | ||
| }, | ||
| "keywords": [ | ||
| "decoupled", | ||
| "react", | ||
| "next.js" | ||
| ], | ||
| "author": "Imran Sayed, Sayed Taqui, Divyaraj Masani, Muhammad Muhsin", | ||
| "license": "MIT", | ||
| "bugs": { | ||
| "url": "https://github.com/rtCamp/wp-decoupled/issues" | ||
| }, | ||
| "engine": { | ||
| "node": "v8.12.0", | ||
| "npm": "6.4.1" | ||
| }, | ||
| "homepage": "https://github.com/rtCamp/wp-decoupled#readme", | ||
| "dependencies": { | ||
| "@apollo/client": "^3.3.6", | ||
| "@zeit/next-css": "^1.0.1", | ||
| "cookie-parser": "^1.4.5", | ||
| "dompurify": "^2.2.6", | ||
| "dotenv": "^8.2.0", | ||
| "express": "^4.17.1", | ||
| "graphql": "^14.7.0", | ||
| "graphql-tag": "^2.11.0", | ||
| "idb-keyval": "^3.2.0", | ||
| "isomorphic-unfetch": "^3.1.0", | ||
| "next": "^10.0.5", | ||
| "next-offline": "^4.0.6", | ||
| "node-fetch": "^2.6.1", | ||
| "nprogress": "^0.2.0", | ||
| "prop-types": "^15.7.2", | ||
| "react": "^17.0.1", | ||
| "react-bootstrap": "^1.4.3", | ||
| "react-dom": "^17.0.1", | ||
| "url-loader": "^2.3.0", | ||
| "validator": "^11.1.0", | ||
| "woocommerce-api": "^1.5.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@zeit/next-sass": "^1.0.1", | ||
| "cypress": "^6.3.0", | ||
| "eslint": "^7.17.0", | ||
| "eslint-config-airbnb": "^18.2.1", | ||
| "eslint-config-prettier": "^7.1.0", | ||
| "eslint-plugin-import": "^2.22.1", | ||
| "eslint-plugin-jsx-a11y": "^6.4.1", | ||
| "eslint-plugin-prettier": "^3.3.1", | ||
| "eslint-plugin-react": "^7.22.0", | ||
| "eslint-plugin-react-hooks": "^4.2.0", | ||
| "next-compose-plugins": "^2.2.1", | ||
| "node-sass": "^4.14.1", | ||
| "prettier": "^2.2.1", | ||
| "serialize-javascript": "^2.1.2" | ||
| } | ||
| } | ||
| "name": "wp-decoupled", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. dont format the package.json |
||
| "version": "1.0.0", | ||
| "description": "A decoupled WordPress application in React built with Next.js", | ||
| "main": "server.js", | ||
| "scripts": { | ||
| "dev": "next dev", | ||
| "dev:inspect": "NODE_OPTIONS='--inspect' next", | ||
| "build": "next build", | ||
| "start": "next start", | ||
| "lint": "eslint --fix .", | ||
| "format": "prettier --write './**/*.{js,jsx,ts,tsx,css,md,json}' --config ./.prettierrc", | ||
| "storybook": "start-storybook -p 6006", | ||
| "build-storybook": "build-storybook" | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "git+https://github.com/rtCamp/wp-decoupled.git" | ||
| }, | ||
| "keywords": [ | ||
| "decoupled", | ||
| "react", | ||
| "next.js" | ||
| ], | ||
| "author": "Imran Sayed, Sayed Taqui, Divyaraj Masani, Muhammad Muhsin", | ||
| "license": "MIT", | ||
| "bugs": { | ||
| "url": "https://github.com/rtCamp/wp-decoupled/issues" | ||
| }, | ||
| "engine": { | ||
| "node": "v8.12.0", | ||
| "npm": "6.4.1" | ||
| }, | ||
| "homepage": "https://github.com/rtCamp/wp-decoupled#readme", | ||
| "dependencies": { | ||
| "@apollo/client": "^3.3.6", | ||
| "@wordpress/block-library": "^2.27.2", | ||
| "@zeit/next-css": "^1.0.1", | ||
| "cookie-parser": "^1.4.5", | ||
| "dompurify": "^2.2.6", | ||
| "dotenv": "^8.2.0", | ||
| "express": "^4.17.1", | ||
| "graphql": "^14.7.0", | ||
| "graphql-tag": "^2.11.0", | ||
| "idb-keyval": "^3.2.0", | ||
| "isomorphic-unfetch": "^3.1.0", | ||
| "next": "^10.0.5", | ||
| "next-offline": "^4.0.6", | ||
| "next-seo": "^4.17.0", | ||
| "node-fetch": "^2.6.1", | ||
| "nprogress": "^0.2.0", | ||
| "prop-types": "^15.7.2", | ||
| "react": "^17.0.1", | ||
| "react-bootstrap": "^1.4.3", | ||
| "react-dom": "^17.0.1", | ||
| "url-loader": "^2.3.0", | ||
| "validator": "^11.1.0", | ||
| "woocommerce-api": "^1.5.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@babel/core": "^7.12.10", | ||
| "@storybook/addon-actions": "^6.1.14", | ||
| "@storybook/addon-essentials": "^6.1.14", | ||
| "@storybook/addon-links": "^6.1.14", | ||
| "@storybook/react": "^6.1.14", | ||
| "@wordpress/base-styles": "^3.3.0", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where are we using this package? |
||
| "@zeit/next-sass": "^1.0.1", | ||
| "babel-loader": "^8.2.2", | ||
| "core-js": "^3.8.3", | ||
| "eslint": "^7.17.0", | ||
| "eslint-config-airbnb": "^18.2.1", | ||
| "eslint-config-prettier": "^7.1.0", | ||
| "eslint-plugin-import": "^2.22.1", | ||
| "eslint-plugin-jsx-a11y": "^6.4.1", | ||
| "eslint-plugin-prettier": "^3.3.1", | ||
| "eslint-plugin-react": "^7.22.0", | ||
| "eslint-plugin-react-hooks": "^4.2.0", | ||
| "next-compose-plugins": "^2.2.1", | ||
| "node-sass": "^4.14.1", | ||
| "prettier": "^2.2.1", | ||
| "serialize-javascript": "^2.1.2" | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,46 +5,71 @@ import AddToCartButton from '../src/components/cart/AddToCartButton'; | |
| import Hero from '../src/components/home/Hero'; | ||
| import Image from '../src/components/Image'; | ||
| import { PRODUCTS_QUERY } from '../src/queries'; | ||
| import { NextSeo } from 'next-seo'; | ||
| import PropTypes from 'prop-types'; | ||
|
|
||
| const NewProducts = ({ products }) => { | ||
|
|
||
| return ( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add Prop types for products, using prop-types npm package |
||
| <div className="container mt-5"> | ||
| <h2 className="text-center mb-5">Products</h2> | ||
| {products.length ? ( | ||
| <div className="mt-2"> | ||
| <div className="products-wrapper row"> | ||
| {products.map((item) => | ||
| // @TODO Need to add support for Group product. | ||
| undefined !== item && 'GroupProduct' !== item.__typename ? ( | ||
| <div className="product-container col-md-3 mb-5" key={item.id}> | ||
| {/* @TODO need to get rid of using databseId here. */} | ||
| <Link href={`/product/${item.slug}`}> | ||
| <a> | ||
| <span className="product-link"> | ||
| <Image | ||
| src={item?.image?.sourceUrl} | ||
| alt={item?.image?.altText || item?.name} | ||
| /> | ||
| <h5 className="product-name">{item.name}</h5> | ||
| <p className="product-price">{item.price}</p> | ||
| </span> | ||
| </a> | ||
| </Link> | ||
| <AddToCartButton product={item} /> | ||
| </div> | ||
| ) : ( | ||
| '' | ||
| ) | ||
| )} | ||
| <> | ||
| <NextSeo | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a todo to make the seo data dynamic, that would later come from WordPress |
||
| title="wp-decoupled seo title" | ||
| description="wp-decoupled products description here." | ||
| // @TODO The SEO data are dynamic, should later come from WordPress. | ||
| /> | ||
| <div className="container mt-5"> | ||
| <h2 className="text-center mb-5">Products</h2> | ||
| {products.length ? ( | ||
| <div className="mt-2"> | ||
| <div className="products-wrapper row"> | ||
| {products.map((item) => | ||
| // @TODO Need to add support for Group product. | ||
| undefined !== item && 'GroupProduct' !== item.__typename ? ( | ||
| <div className="product-container col-md-3 mb-5" key={item.id}> | ||
| {/* @TODO need to get rid of using databseId here. */} | ||
| <Link href={`/product/${item?.slug}`}> | ||
| <a> | ||
| <span className="product-link"> | ||
| <Image | ||
| src={item?.image?.sourceUrl} | ||
| alt={item?.image?.altText || item?.name} | ||
| /> | ||
| <h5 className="product-name">{item?.name}</h5> | ||
| <p className="product-price">{item?.price}</p> | ||
| </span> | ||
| </a> | ||
| </Link> | ||
| <AddToCartButton product={item} /> | ||
| </div> | ||
| ) : ( | ||
| null | ||
| ) | ||
| )} | ||
| </div> | ||
| </div> | ||
| </div> | ||
| ) : ( | ||
| '' | ||
| )} | ||
| </div> | ||
| ) : ( | ||
| null | ||
| )} | ||
| </div> | ||
| </> | ||
| ); | ||
| }; | ||
|
|
||
| NewProducts.propTypes = { | ||
| products: PropTypes.arrayOf( | ||
| PropTypes.shape({ | ||
| databaseId: PropTypes.integer, | ||
| averageRating: PropTypes.integer, | ||
| description: PropTypes.integer, | ||
| id: PropTypes.string, | ||
| image: PropTypes.object, | ||
| name: PropTypes.integer, | ||
| price: PropTypes.integer, | ||
| slug: PropTypes.integer, | ||
| }) | ||
| ), | ||
| } | ||
|
|
||
| const Index = (props) => { | ||
| const { products } = props; | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.