From b4056b901c8166727e703c23679b886ca82a9b20 Mon Sep 17 00:00:00 2001 From: Brandon Pittman Date: Wed, 28 Oct 2020 11:43:46 +0900 Subject: [PATCH 01/18] Update tailwind.config.js Tailwind already includes a .75 bgOpacity utility. https://tailwindcss.com/docs/background-opacity#app --- tailwind.config.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/tailwind.config.js b/tailwind.config.js index fcadb5892..ec80f58e3 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -10,9 +10,6 @@ module.exports = { maxWidth: { '8xl': '1920px', }, - backgroundOpacity: { - 075: '0.75', - }, colors: { primary: 'var(--primary)', 'primary-2': 'var(--primary-2)', From 5fcca0fe31bf8ea9d0cd6157bd14b161c7042294 Mon Sep 17 00:00:00 2001 From: Martin Bavio Date: Wed, 28 Oct 2020 02:00:38 -0300 Subject: [PATCH 02/18] Add an env template and some notes in the readme --- .env.template | 5 +++++ README.md | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 .env.template diff --git a/.env.template b/.env.template new file mode 100644 index 000000000..73a8a6e3b --- /dev/null +++ b/.env.template @@ -0,0 +1,5 @@ +BIGCOMMERCE_STOREFRONT_API_URL= +BIGCOMMERCE_STOREFRONT_API_TOKEN= +BIGCOMMERCE_STORE_API_URL= +BIGCOMMERCE_STORE_API_TOKEN= +BIGCOMMERCE_STORE_API_CLIENT_ID= \ No newline at end of file diff --git a/README.md b/README.md index 1afa87f56..76b311e42 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,8 @@ Our commitment to Open Source can be found [here](https://vercel.com/oss). 2. Create a new branch `git checkout -b MY_BRANCH_NAME` 3. Install yarn: `npm install -g yarn` 4. Install the dependencies: `yarn` -5. Run `yarn dev` to build and watch for code changes -6. The development branch is `development` (this is the branch pull requests should be made against). +5. Duplicate `.env.template` and rename it to `.env.local`. +6. Add proper store values to `.env.local`. +7. Run `yarn dev` to build and watch for code changes +8. The development branch is `development` (this is the branch pull requests should be made against). On a release, the relevant parts of the changes in the `staging` branch are rebased into `master`. From 9dc45aad697be731c54692a408403a47808ee6c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adem=C3=ADlson=20F=2E=20Tonato?= Date: Wed, 28 Oct 2020 10:45:37 +0000 Subject: [PATCH 03/18] fix: adjust min and max width of the add to cart button --- components/product/ProductView/ProductView.module.css | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/components/product/ProductView/ProductView.module.css b/components/product/ProductView/ProductView.module.css index ddcb42667..dec06f665 100644 --- a/components/product/ProductView/ProductView.module.css +++ b/components/product/ProductView/ProductView.module.css @@ -78,8 +78,13 @@ } .button { - min-width: 300px; text-align: center; + width: 100%; + max-width: 300px; + + @screen sm { + min-width: 300px; + } } .wishlistButton { From 80b96115b61b5bc6c85b819270ad327eb1909ce0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adem=C3=ADlson=20F=2E=20Tonato?= Date: Wed, 28 Oct 2020 10:46:43 +0000 Subject: [PATCH 04/18] fix: define min input width only for the required viewports --- components/core/Searchbar/Searchbar.module.css | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/core/Searchbar/Searchbar.module.css b/components/core/Searchbar/Searchbar.module.css index edfdeb53a..500483195 100644 --- a/components/core/Searchbar/Searchbar.module.css +++ b/components/core/Searchbar/Searchbar.module.css @@ -1,6 +1,9 @@ .input { @apply bg-transparent px-3 py-2 appearance-none w-full transition duration-150 ease-in-out pr-10; - min-width: 300px; + + @screen sm { + min-width: 300px; + } } .input:focus { From 6da1a170eee2526647e96aa8c5b9425f92b6c6ec Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Wed, 28 Oct 2020 11:34:47 -0300 Subject: [PATCH 05/18] Removing font --- assets/base.css | 2 + assets/font.css | 628 ------------------------------------------------ 2 files changed, 2 insertions(+), 628 deletions(-) delete mode 100644 assets/font.css diff --git a/assets/base.css b/assets/base.css index 7be74ba3d..781ebe0ac 100644 --- a/assets/base.css +++ b/assets/base.css @@ -35,6 +35,8 @@ --accents-7: #495057; --accents-8: #343a40; --accents-9: #212529; + --font-sans: -apple-system, system-ui, BlinkMacSystemFont, 'Helvetica Neue', + 'Helvetica', sans-serif; } [data-theme='dark'] { diff --git a/assets/font.css b/assets/font.css deleted file mode 100644 index c4b605c34..000000000 --- a/assets/font.css +++ /dev/null @@ -1,628 +0,0 @@ -/* latin */ -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 100; - font-display: block; - src: url(https://assets.vercel.com/raw/upload/v1587415301/fonts/2/inter-var-latin.woff2) - format('woff2'); - unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, - U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, - U+FEFF, U+FFFD; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 200; - font-display: block; - src: url(https://assets.vercel.com/raw/upload/v1587415301/fonts/2/inter-var-latin.woff2) - format('woff2'); - unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, - U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, - U+FEFF, U+FFFD; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 300; - font-display: block; - src: url(https://assets.vercel.com/raw/upload/v1587415301/fonts/2/inter-var-latin.woff2) - format('woff2'); - unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, - U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, - U+FEFF, U+FFFD; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 400; - font-display: block; - src: url(https://assets.vercel.com/raw/upload/v1587415301/fonts/2/inter-var-latin.woff2) - format('woff2'); - unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, - U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, - U+FEFF, U+FFFD; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 500; - font-display: block; - src: url(https://assets.vercel.com/raw/upload/v1587415301/fonts/2/inter-var-latin.woff2) - format('woff2'); - unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, - U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, - U+FEFF, U+FFFD; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 600; - font-display: block; - src: url(https://assets.vercel.com/raw/upload/v1587415301/fonts/2/inter-var-latin.woff2) - format('woff2'); - unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, - U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, - U+FEFF, U+FFFD; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 700; - font-display: block; - src: url(https://assets.vercel.com/raw/upload/v1587415301/fonts/2/inter-var-latin.woff2) - format('woff2'); - unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, - U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, - U+FEFF, U+FFFD; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 800; - font-display: block; - src: url(https://assets.vercel.com/raw/upload/v1587415301/fonts/2/inter-var-latin.woff2) - format('woff2'); - unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, - U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, - U+FEFF, U+FFFD; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 900; - font-display: block; - src: url(https://assets.vercel.com/raw/upload/v1587415301/fonts/2/inter-var-latin.woff2) - format('woff2'); - unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, - U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, - U+FEFF, U+FFFD; -} - -/* these other fonts are only used and downloaded when a special chars is shown -in most cases, they are not downloaded at all */ - -/* latin-ext */ -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 100; - font-display: swap; - src: url(https://assets.vercel.com/raw/upload/v1587418275/fonts/2/inter-var-latin-ext.woff2) - format('woff2'); - unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, - U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 200; - font-display: swap; - src: url(https://assets.vercel.com/raw/upload/v1587418275/fonts/2/inter-var-latin-ext.woff2) - format('woff2'); - unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, - U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 300; - font-display: swap; - src: url(https://assets.vercel.com/raw/upload/v1587418275/fonts/2/inter-var-latin-ext.woff2) - format('woff2'); - unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, - U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 400; - font-display: swap; - src: url(https://assets.vercel.com/raw/upload/v1587418275/fonts/2/inter-var-latin-ext.woff2) - format('woff2'); - unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, - U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 500; - font-display: swap; - src: url(https://assets.vercel.com/raw/upload/v1587418275/fonts/2/inter-var-latin-ext.woff2) - format('woff2'); - unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, - U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 600; - font-display: swap; - src: url(https://assets.vercel.com/raw/upload/v1587418275/fonts/2/inter-var-latin-ext.woff2) - format('woff2'); - unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, - U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 700; - font-display: swap; - src: url(https://assets.vercel.com/raw/upload/v1587418275/fonts/2/inter-var-latin-ext.woff2) - format('woff2'); - unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, - U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 800; - font-display: swap; - src: url(https://assets.vercel.com/raw/upload/v1587418275/fonts/2/inter-var-latin-ext.woff2) - format('woff2'); - unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, - U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 900; - font-display: swap; - src: url(https://assets.vercel.com/raw/upload/v1587418275/fonts/2/inter-var-latin-ext.woff2) - format('woff2'); - unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, - U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; -} - -/* cyrillic */ -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 100; - font-display: swap; - src: url(https://assets.vercel.com/raw/upload/v1587418276/fonts/2/inter-var-cyrillic.woff2) - format('woff2'); - unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 200; - font-display: swap; - src: url(https://assets.vercel.com/raw/upload/v1587418276/fonts/2/inter-var-cyrillic.woff2) - format('woff2'); - unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 300; - font-display: swap; - src: url(https://assets.vercel.com/raw/upload/v1587418276/fonts/2/inter-var-cyrillic.woff2) - format('woff2'); - unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 400; - font-display: swap; - src: url(https://assets.vercel.com/raw/upload/v1587418276/fonts/2/inter-var-cyrillic.woff2) - format('woff2'); - unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 500; - font-display: swap; - src: url(https://assets.vercel.com/raw/upload/v1587418276/fonts/2/inter-var-cyrillic.woff2) - format('woff2'); - unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 600; - font-display: swap; - src: url(https://assets.vercel.com/raw/upload/v1587418276/fonts/2/inter-var-cyrillic.woff2) - format('woff2'); - unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 700; - font-display: swap; - src: url(https://assets.vercel.com/raw/upload/v1587418276/fonts/2/inter-var-cyrillic.woff2) - format('woff2'); - unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 800; - font-display: swap; - src: url(https://assets.vercel.com/raw/upload/v1587418276/fonts/2/inter-var-cyrillic.woff2) - format('woff2'); - unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 900; - font-display: swap; - src: url(https://assets.vercel.com/raw/upload/v1587418276/fonts/2/inter-var-cyrillic.woff2) - format('woff2'); - unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; -} - -/* cyrillic-ext */ -@font-face { - font-family: 'Inter'; - font-style: swap; - font-weight: 100; - font-display: block; - src: url(https://assets.vercel.com/raw/upload/v1587418127/fonts/2/inter-var-cyrillic-ext.woff2) - format('woff2'); - unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, - U+FE2E-FE2F; -} -@font-face { - font-family: 'Inter'; - font-style: swap; - font-weight: 200; - font-display: block; - src: url(https://assets.vercel.com/raw/upload/v1587418127/fonts/2/inter-var-cyrillic-ext.woff2) - format('woff2'); - unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, - U+FE2E-FE2F; -} -@font-face { - font-family: 'Inter'; - font-style: swap; - font-weight: 300; - font-display: block; - src: url(https://assets.vercel.com/raw/upload/v1587418127/fonts/2/inter-var-cyrillic-ext.woff2) - format('woff2'); - unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, - U+FE2E-FE2F; -} -@font-face { - font-family: 'Inter'; - font-style: swap; - font-weight: 400; - font-display: block; - src: url(https://assets.vercel.com/raw/upload/v1587418127/fonts/2/inter-var-cyrillic-ext.woff2) - format('woff2'); - unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, - U+FE2E-FE2F; -} -@font-face { - font-family: 'Inter'; - font-style: swap; - font-weight: 500; - font-display: block; - src: url(https://assets.vercel.com/raw/upload/v1587418127/fonts/2/inter-var-cyrillic-ext.woff2) - format('woff2'); - unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, - U+FE2E-FE2F; -} -@font-face { - font-family: 'Inter'; - font-style: swap; - font-weight: 600; - font-display: block; - src: url(https://assets.vercel.com/raw/upload/v1587418127/fonts/2/inter-var-cyrillic-ext.woff2) - format('woff2'); - unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, - U+FE2E-FE2F; -} -@font-face { - font-family: 'Inter'; - font-style: swap; - font-weight: 700; - font-display: block; - src: url(https://assets.vercel.com/raw/upload/v1587418127/fonts/2/inter-var-cyrillic-ext.woff2) - format('woff2'); - unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, - U+FE2E-FE2F; -} -@font-face { - font-family: 'Inter'; - font-style: swap; - font-weight: 800; - font-display: block; - src: url(https://assets.vercel.com/raw/upload/v1587418127/fonts/2/inter-var-cyrillic-ext.woff2) - format('woff2'); - unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, - U+FE2E-FE2F; -} -@font-face { - font-family: 'Inter'; - font-style: swap; - font-weight: 900; - font-display: block; - src: url(https://assets.vercel.com/raw/upload/v1587418127/fonts/2/inter-var-cyrillic-ext.woff2) - format('woff2'); - unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, - U+FE2E-FE2F; -} - -/* greek */ -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 100; - font-display: swap; - src: url(https://assets.vercel.com/raw/upload/v1587418276/fonts/2/inter-var-greek.woff2) - format('woff2'); - unicode-range: U+0370-03FF; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 200; - font-display: swap; - src: url(https://assets.vercel.com/raw/upload/v1587418276/fonts/2/inter-var-greek.woff2) - format('woff2'); - unicode-range: U+0370-03FF; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 300; - font-display: swap; - src: url(https://assets.vercel.com/raw/upload/v1587418276/fonts/2/inter-var-greek.woff2) - format('woff2'); - unicode-range: U+0370-03FF; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 400; - font-display: swap; - src: url(https://assets.vercel.com/raw/upload/v1587418276/fonts/2/inter-var-greek.woff2) - format('woff2'); - unicode-range: U+0370-03FF; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 500; - font-display: swap; - src: url(https://assets.vercel.com/raw/upload/v1587418276/fonts/2/inter-var-greek.woff2) - format('woff2'); - unicode-range: U+0370-03FF; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 600; - font-display: swap; - src: url(https://assets.vercel.com/raw/upload/v1587418276/fonts/2/inter-var-greek.woff2) - format('woff2'); - unicode-range: U+0370-03FF; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 700; - font-display: swap; - src: url(https://assets.vercel.com/raw/upload/v1587418276/fonts/2/inter-var-greek.woff2) - format('woff2'); - unicode-range: U+0370-03FF; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 800; - font-display: swap; - src: url(https://assets.vercel.com/raw/upload/v1587418276/fonts/2/inter-var-greek.woff2) - format('woff2'); - unicode-range: U+0370-03FF; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 900; - font-display: swap; - src: url(https://assets.vercel.com/raw/upload/v1587418276/fonts/2/inter-var-greek.woff2) - format('woff2'); - unicode-range: U+0370-03FF; -} - -/* greek-ext */ -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 100; - font-display: swap; - src: url(https://assets.vercel.com/raw/upload/v1587418275/fonts/2/inter-var-greek-ext.woff2) - format('woff2'); - unicode-range: U+1F00-1FFF; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 200; - font-display: swap; - src: url(https://assets.vercel.com/raw/upload/v1587418275/fonts/2/inter-var-greek-ext.woff2) - format('woff2'); - unicode-range: U+1F00-1FFF; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 300; - font-display: swap; - src: url(https://assets.vercel.com/raw/upload/v1587418275/fonts/2/inter-var-greek-ext.woff2) - format('woff2'); - unicode-range: U+1F00-1FFF; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 400; - font-display: swap; - src: url(https://assets.vercel.com/raw/upload/v1587418275/fonts/2/inter-var-greek-ext.woff2) - format('woff2'); - unicode-range: U+1F00-1FFF; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 500; - font-display: swap; - src: url(https://assets.vercel.com/raw/upload/v1587418275/fonts/2/inter-var-greek-ext.woff2) - format('woff2'); - unicode-range: U+1F00-1FFF; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 600; - font-display: swap; - src: url(https://assets.vercel.com/raw/upload/v1587418275/fonts/2/inter-var-greek-ext.woff2) - format('woff2'); - unicode-range: U+1F00-1FFF; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 700; - font-display: swap; - src: url(https://assets.vercel.com/raw/upload/v1587418275/fonts/2/inter-var-greek-ext.woff2) - format('woff2'); - unicode-range: U+1F00-1FFF; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 800; - font-display: swap; - src: url(https://assets.vercel.com/raw/upload/v1587418275/fonts/2/inter-var-greek-ext.woff2) - format('woff2'); - unicode-range: U+1F00-1FFF; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 900; - font-display: swap; - src: url(https://assets.vercel.com/raw/upload/v1587418275/fonts/2/inter-var-greek-ext.woff2) - format('woff2'); - unicode-range: U+1F00-1FFF; -} - -/* vietnamese */ -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 100; - font-display: swap; - src: url(https://assets.vercel.com/raw/upload/v1587418275/fonts/2/inter-var-vietnamese.woff2) - format('woff2'); - unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, - U+01AF-01B0, U+1EA0-1EF9, U+20AB; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 200; - font-display: swap; - src: url(https://assets.vercel.com/raw/upload/v1587418275/fonts/2/inter-var-vietnamese.woff2) - format('woff2'); - unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, - U+01AF-01B0, U+1EA0-1EF9, U+20AB; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 300; - font-display: swap; - src: url(https://assets.vercel.com/raw/upload/v1587418275/fonts/2/inter-var-vietnamese.woff2) - format('woff2'); - unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, - U+01AF-01B0, U+1EA0-1EF9, U+20AB; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 400; - font-display: swap; - src: url(https://assets.vercel.com/raw/upload/v1587418275/fonts/2/inter-var-vietnamese.woff2) - format('woff2'); - unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, - U+01AF-01B0, U+1EA0-1EF9, U+20AB; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 500; - font-display: swap; - src: url(https://assets.vercel.com/raw/upload/v1587418275/fonts/2/inter-var-vietnamese.woff2) - format('woff2'); - unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, - U+01AF-01B0, U+1EA0-1EF9, U+20AB; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 600; - font-display: swap; - src: url(https://assets.vercel.com/raw/upload/v1587418275/fonts/2/inter-var-vietnamese.woff2) - format('woff2'); - unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, - U+01AF-01B0, U+1EA0-1EF9, U+20AB; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 700; - font-display: swap; - src: url(https://assets.vercel.com/raw/upload/v1587418275/fonts/2/inter-var-vietnamese.woff2) - format('woff2'); - unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, - U+01AF-01B0, U+1EA0-1EF9, U+20AB; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 800; - font-display: swap; - src: url(https://assets.vercel.com/raw/upload/v1587418275/fonts/2/inter-var-vietnamese.woff2) - format('woff2'); - unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, - U+01AF-01B0, U+1EA0-1EF9, U+20AB; -} -@font-face { - font-family: 'Inter'; - font-style: normal; - font-weight: 900; - font-display: swap; - src: url(https://assets.vercel.com/raw/upload/v1587418275/fonts/2/inter-var-vietnamese.woff2) - format('woff2'); - unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, - U+01AF-01B0, U+1EA0-1EF9, U+20AB; -} From a590093f098fcacef32b806e93f61790ce6d8a55 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Wed, 28 Oct 2020 11:37:14 -0300 Subject: [PATCH 06/18] Removing font --- assets/main.css | 1 - 1 file changed, 1 deletion(-) diff --git a/assets/main.css b/assets/main.css index 8e2a74c27..54dd1e50f 100644 --- a/assets/main.css +++ b/assets/main.css @@ -1,5 +1,4 @@ @tailwind base; -@import './font.css'; @import './base.css'; @tailwind components; From 48e35c9163f74599fb8abf2911f6b5971d9881c7 Mon Sep 17 00:00:00 2001 From: Willian Justen de Vasconcellos Date: Tue, 27 Oct 2020 17:56:59 -0300 Subject: [PATCH 07/18] Fix overlaping product titles on mobile Add an `extra-loose` line-height so it prevents produt title to overlap on mobile screens. --- components/product/ProductCard/ProductCard.module.css | 2 +- components/product/ProductCard/ProductCard.tsx | 2 +- tailwind.config.js | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/components/product/ProductCard/ProductCard.module.css b/components/product/ProductCard/ProductCard.module.css index 0c8dd1c04..72e517f18 100644 --- a/components/product/ProductCard/ProductCard.module.css +++ b/components/product/ProductCard/ProductCard.module.css @@ -101,7 +101,7 @@ } .productTitle { - @apply pt-2 max-w-full w-full; + @apply max-w-full w-full; font-size: 2rem; letter-spacing: 0.4px; diff --git a/components/product/ProductCard/ProductCard.tsx b/components/product/ProductCard/ProductCard.tsx index f047136b4..3eacee42d 100644 --- a/components/product/ProductCard/ProductCard.tsx +++ b/components/product/ProductCard/ProductCard.tsx @@ -57,7 +57,7 @@ const ProductCard: FC = ({
-

+

{p.name}

{price} diff --git a/tailwind.config.js b/tailwind.config.js index ec80f58e3..3535079a7 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -46,6 +46,9 @@ module.exports = { magical: 'rgba(0, 0, 0, 0.02) 0px 30px 30px, rgba(0, 0, 0, 0.03) 0px 0px 8px, rgba(0, 0, 0, 0.05) 0px 1px 0px', }, + lineHeight: { + 'extra-loose': '2.3' + } }, }, plugins: [require('@tailwindcss/ui')], From 65d6ba7a7ee83fe25ef5844ea02dba1170ed9311 Mon Sep 17 00:00:00 2001 From: Willian Justen de Vasconcellos Date: Tue, 27 Oct 2020 20:16:23 -0300 Subject: [PATCH 08/18] Move styles to use @apply instead of responsive classes --- components/product/ProductCard/ProductCard.module.css | 2 +- components/product/ProductCard/ProductCard.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/product/ProductCard/ProductCard.module.css b/components/product/ProductCard/ProductCard.module.css index 72e517f18..26dd05e84 100644 --- a/components/product/ProductCard/ProductCard.module.css +++ b/components/product/ProductCard/ProductCard.module.css @@ -101,7 +101,7 @@ } .productTitle { - @apply max-w-full w-full; + @apply pt-0 max-w-full w-full leading-extra-loose; font-size: 2rem; letter-spacing: 0.4px; diff --git a/components/product/ProductCard/ProductCard.tsx b/components/product/ProductCard/ProductCard.tsx index 3eacee42d..f047136b4 100644 --- a/components/product/ProductCard/ProductCard.tsx +++ b/components/product/ProductCard/ProductCard.tsx @@ -57,7 +57,7 @@ const ProductCard: FC = ({
-

+

{p.name}

{price} From a0fee94223bb0ff35abb7a0c47a49fd1d7349c96 Mon Sep 17 00:00:00 2001 From: Willian Justen de Vasconcellos Date: Wed, 28 Oct 2020 11:47:45 -0300 Subject: [PATCH 09/18] Change extra-loose size to accomodate system font --- tailwind.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tailwind.config.js b/tailwind.config.js index 3535079a7..24416d3e7 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -47,7 +47,7 @@ module.exports = { 'rgba(0, 0, 0, 0.02) 0px 30px 30px, rgba(0, 0, 0, 0.03) 0px 0px 8px, rgba(0, 0, 0, 0.05) 0px 1px 0px', }, lineHeight: { - 'extra-loose': '2.3' + 'extra-loose': '2.2' } }, }, From c4ed4e934de52a21be32a2a55c95cdc2ce4d0f04 Mon Sep 17 00:00:00 2001 From: Willian Justen de Vasconcellos Date: Wed, 28 Oct 2020 16:12:23 -0300 Subject: [PATCH 10/18] Simplify Simple ProductTitle --- components/product/ProductCard/ProductCard.module.css | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/components/product/ProductCard/ProductCard.module.css b/components/product/ProductCard/ProductCard.module.css index 26dd05e84..2a1c28c2e 100644 --- a/components/product/ProductCard/ProductCard.module.css +++ b/components/product/ProductCard/ProductCard.module.css @@ -88,10 +88,11 @@ } & .productTitle { - margin-top: -7px; + @apply pt-2; font-size: 1rem; + & span { - line-height: 3; + @apply leading-extra-loose; } } From 2a843d7700062bc7b2be33d1fa0e61abea71363c Mon Sep 17 00:00:00 2001 From: Enrique Benitez Date: Thu, 29 Oct 2020 16:04:13 -0600 Subject: [PATCH 11/18] Use price hook in slug page --- components/product/ProductView/ProductView.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/components/product/ProductView/ProductView.tsx b/components/product/ProductView/ProductView.tsx index 57df704c7..f4d8dd681 100644 --- a/components/product/ProductView/ProductView.tsx +++ b/components/product/ProductView/ProductView.tsx @@ -9,6 +9,7 @@ import { Swatch, ProductSlider } from '@components/product' import { Button, Container } from '@components/ui' import { HTMLContent } from '@components/core' +import usePrice from '@bigcommerce/storefront-data-hooks/use-price' import useAddItem from '@bigcommerce/storefront-data-hooks/cart/use-add-item' import type { ProductNode } from '@bigcommerce/storefront-data-hooks/api/operations/get-product' import { @@ -26,6 +27,11 @@ interface Props { const ProductView: FC = ({ product }) => { const addItem = useAddItem() + const { price } = usePrice({ + amount: product.prices?.price.value, + baseAmount: product.prices?.retailPrice?.value, + currencyCode: product.prices?.price?.currencyCode!, + }) const { openSidebar } = useUI() const options = getProductOptions(product) const [loading, setLoading] = useState(false) @@ -74,7 +80,7 @@ const ProductView: FC = ({ product }) => {

{product.name}

- {product.prices?.price.value} + {price} {` `} {product.prices?.price.currencyCode}
From cd829884f96e930e2e245c22084c23e84aba4313 Mon Sep 17 00:00:00 2001 From: Enrique Benitez Date: Thu, 29 Oct 2020 16:41:37 -0600 Subject: [PATCH 12/18] Add optional chaining operator --- components/product/ProductView/ProductView.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/product/ProductView/ProductView.tsx b/components/product/ProductView/ProductView.tsx index f4d8dd681..8e004d857 100644 --- a/components/product/ProductView/ProductView.tsx +++ b/components/product/ProductView/ProductView.tsx @@ -28,7 +28,7 @@ interface Props { const ProductView: FC = ({ product }) => { const addItem = useAddItem() const { price } = usePrice({ - amount: product.prices?.price.value, + amount: product.prices?.price?.value, baseAmount: product.prices?.retailPrice?.value, currencyCode: product.prices?.price?.currencyCode!, }) From fc09363bab29e563abad80f218674e676c816346 Mon Sep 17 00:00:00 2001 From: Luis Alvarez Date: Thu, 29 Oct 2020 18:20:41 -0500 Subject: [PATCH 13/18] Update to Next.js 10 --- package.json | 2 +- yarn.lock | 48 ++++++++++++++++++++++++------------------------ 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/package.json b/package.json index 1d2bce171..a6d84adfd 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "keen-slider": "^5.2.4", "lodash.debounce": "^4.0.8", "lodash.random": "^3.2.0", - "next": "^9.5.6-canary.17", + "next": "^10.0.0", "next-seo": "^4.11.0", "next-themes": "^0.0.4", "postcss-import": "^13.0.0", diff --git a/yarn.lock b/yarn.lock index bbd30ddc9..737dfab17 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1132,20 +1132,20 @@ dependencies: webpack-bundle-analyzer "3.6.1" -"@next/env@9.5.6-canary.17": - version "9.5.6-canary.17" - resolved "https://registry.yarnpkg.com/@next/env/-/env-9.5.6-canary.17.tgz#d0289faee8ff5635973661580e3b2848add94534" - integrity sha512-O8noGIlyNHfhT/6oHePxfYAa3hNf4arRJ66RsSkodg4bAI4+tY5glOE8YZ+wn4q84Of6QVVh7R3tJzL8oK714w== +"@next/env@10.0.0": + version "10.0.0" + resolved "https://registry.yarnpkg.com/@next/env/-/env-10.0.0.tgz#eb0239062226a9c8b604d58d4a4204e26c22eb16" + integrity sha512-59+6BnOxPoMY64Qy2crDGHtvQgHwIL1SIkWeNiEud1V6ASs59SM9oDGN+Bo/EswII1nn+wQRpMvax0IIN2j+VQ== -"@next/polyfill-module@9.5.6-canary.17": - version "9.5.6-canary.17" - resolved "https://registry.yarnpkg.com/@next/polyfill-module/-/polyfill-module-9.5.6-canary.17.tgz#c7c26939804b24d80151cc2af775e65ee97e3465" - integrity sha512-zS5jmDwCiUpelp5BAc1e6vKSkKQkFHj53IhP+khkmDab48uv99iK32/qjNGurqyaHTbLjSXsPIGFmdKQ0hyE+A== +"@next/polyfill-module@10.0.0": + version "10.0.0" + resolved "https://registry.yarnpkg.com/@next/polyfill-module/-/polyfill-module-10.0.0.tgz#17f59cb7325a03f23b66b979fccc56d133411b0a" + integrity sha512-FLSwwWQaP/sXjlS7w4YFu+oottbo/bjoh+L+YED7dblsaRJT89ifV+h8zvLvh1hCL7FJUYVar4rehvj/VO5T9w== -"@next/react-dev-overlay@9.5.6-canary.17": - version "9.5.6-canary.17" - resolved "https://registry.yarnpkg.com/@next/react-dev-overlay/-/react-dev-overlay-9.5.6-canary.17.tgz#0ad416c4d323fa013ee494f3fa3ac7e83bbc0c6b" - integrity sha512-0fBLm2UNHpJKUhqecs95KxVWVQWvf0Xz9vs8G1J8hO8WMUkAEiuvOt6w9BG94a6/xL3tPzBF1B3t4q/k0YT7Dg== +"@next/react-dev-overlay@10.0.0": + version "10.0.0" + resolved "https://registry.yarnpkg.com/@next/react-dev-overlay/-/react-dev-overlay-10.0.0.tgz#ba1acc79bc9d874f1801a0b312e6a45de74bf425" + integrity sha512-HJ44TJXtaGfGxVtljPECZvqw+GctVvBr60Rsedo5A+wU2GIiycJ8n5yUSdc9UiYTnPuxfJFicJec6kgR6GSWKA== dependencies: "@babel/code-frame" "7.10.4" ally.js "1.4.1" @@ -1158,10 +1158,10 @@ stacktrace-parser "0.1.10" strip-ansi "6.0.0" -"@next/react-refresh-utils@9.5.6-canary.17": - version "9.5.6-canary.17" - resolved "https://registry.yarnpkg.com/@next/react-refresh-utils/-/react-refresh-utils-9.5.6-canary.17.tgz#fb7ee8b51490187de72b27e0de5f9bd83ab2f310" - integrity sha512-Q2IU1MC8B9329WQQ1vZ/B3i7AcjBMQGcTCGf/QHRzzaqPa0zL90cCAksBCAxx5zbMv3BIJNrY+1VI+KYj5Po9A== +"@next/react-refresh-utils@10.0.0": + version "10.0.0" + resolved "https://registry.yarnpkg.com/@next/react-refresh-utils/-/react-refresh-utils-10.0.0.tgz#45cdd1ad3b55ac442f8431cdc43ff53c3dc44d16" + integrity sha512-V1/oiDWb2C1Do0eZONsKX1aqGNkqCUqxUahIiCjwKFu9c3bps+Ygg4JjtaCd9oycv0KzYImUZnU+nqveFUjxUw== "@npmcli/move-file@^1.0.1": version "1.0.1" @@ -4305,10 +4305,10 @@ next-tick@~1.0.0: resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c" integrity sha1-yobR/ogoFpsBICCOPchCS524NCw= -next@^9.5.6-canary.17: - version "9.5.6-canary.17" - resolved "https://registry.yarnpkg.com/next/-/next-9.5.6-canary.17.tgz#4ded8274457c05ac5028643fe9dfaf9f2808e300" - integrity sha512-ocUNL44RA/0vD43uR91JBtfBvHwDlclqPkno+9un01XUw41ZJFn6aSd6VqiLFOZ5eCWk6lK5WbcfJiOH/aV1Rg== +next@^10.0.0: + version "10.0.0" + resolved "https://registry.yarnpkg.com/next/-/next-10.0.0.tgz#fbc82fa69f05bf82fb5c4e160151f38fb9615e99" + integrity sha512-hpJkikt6tqwj7DfD5Mizwc1kDsaaS73TQK6lJL+++Ht8QXIEs+KUqTZULgdMk80mDV2Zhzo9/JYMEranWwAFLA== dependencies: "@ampproject/toolbox-optimizer" "2.7.0-alpha.1" "@babel/code-frame" "7.10.4" @@ -4329,10 +4329,10 @@ next@^9.5.6-canary.17: "@babel/runtime" "7.11.2" "@babel/types" "7.11.5" "@hapi/accept" "5.0.1" - "@next/env" "9.5.6-canary.17" - "@next/polyfill-module" "9.5.6-canary.17" - "@next/react-dev-overlay" "9.5.6-canary.17" - "@next/react-refresh-utils" "9.5.6-canary.17" + "@next/env" "10.0.0" + "@next/polyfill-module" "10.0.0" + "@next/react-dev-overlay" "10.0.0" + "@next/react-refresh-utils" "10.0.0" ast-types "0.13.2" babel-plugin-transform-define "2.0.0" babel-plugin-transform-react-remove-prop-types "0.4.24" From 79491a5b3ffb67156a0e6c4d8ed837a40736ee05 Mon Sep 17 00:00:00 2001 From: Luis Alvarez Date: Thu, 29 Oct 2020 19:03:18 -0500 Subject: [PATCH 14/18] Update lo latest canary --- next.config.js | 8 +++----- package.json | 2 +- yarn.lock | 48 ++++++++++++++++++++++++------------------------ 3 files changed, 28 insertions(+), 30 deletions(-) diff --git a/next.config.js b/next.config.js index 846dc61f3..080dd8066 100644 --- a/next.config.js +++ b/next.config.js @@ -3,11 +3,9 @@ module.exports = { sizes: [320, 480, 820, 1200, 1600], domains: ['cdn11.bigcommerce.com'], }, - experimental: { - i18n: { - locales: ['en-US', 'es'], - defaultLocale: 'en-US', - }, + i18n: { + locales: ['en-US', 'es'], + defaultLocale: 'en-US', }, rewrites() { return [ diff --git a/package.json b/package.json index a6d84adfd..565fc54de 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "keen-slider": "^5.2.4", "lodash.debounce": "^4.0.8", "lodash.random": "^3.2.0", - "next": "^10.0.0", + "next": "^10.0.1-canary.1", "next-seo": "^4.11.0", "next-themes": "^0.0.4", "postcss-import": "^13.0.0", diff --git a/yarn.lock b/yarn.lock index 737dfab17..4a2aff44c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1132,20 +1132,20 @@ dependencies: webpack-bundle-analyzer "3.6.1" -"@next/env@10.0.0": - version "10.0.0" - resolved "https://registry.yarnpkg.com/@next/env/-/env-10.0.0.tgz#eb0239062226a9c8b604d58d4a4204e26c22eb16" - integrity sha512-59+6BnOxPoMY64Qy2crDGHtvQgHwIL1SIkWeNiEud1V6ASs59SM9oDGN+Bo/EswII1nn+wQRpMvax0IIN2j+VQ== +"@next/env@10.0.1-canary.1": + version "10.0.1-canary.1" + resolved "https://registry.yarnpkg.com/@next/env/-/env-10.0.1-canary.1.tgz#c49199b5dda48b7ef77cfc044fb2a38e6bc71e7d" + integrity sha512-f2OOhLRHym6WXKEngB+mwGxp48xQBY7sj2/N3s19zOp4HJn+4evKcq5lvtBL4N2K74L/ObCw1l/xTrruvk8WfQ== -"@next/polyfill-module@10.0.0": - version "10.0.0" - resolved "https://registry.yarnpkg.com/@next/polyfill-module/-/polyfill-module-10.0.0.tgz#17f59cb7325a03f23b66b979fccc56d133411b0a" - integrity sha512-FLSwwWQaP/sXjlS7w4YFu+oottbo/bjoh+L+YED7dblsaRJT89ifV+h8zvLvh1hCL7FJUYVar4rehvj/VO5T9w== +"@next/polyfill-module@10.0.1-canary.1": + version "10.0.1-canary.1" + resolved "https://registry.yarnpkg.com/@next/polyfill-module/-/polyfill-module-10.0.1-canary.1.tgz#ab97dce131db21dc70adeab552e01a20918f193f" + integrity sha512-/Kc9lXbDjGnGQogk9Hb5bYjx2031bXDnZVatBblzOt1cGapkiX8P5OOgnXv4ki17GtWW4/epPKzTfm2i3T9YPA== -"@next/react-dev-overlay@10.0.0": - version "10.0.0" - resolved "https://registry.yarnpkg.com/@next/react-dev-overlay/-/react-dev-overlay-10.0.0.tgz#ba1acc79bc9d874f1801a0b312e6a45de74bf425" - integrity sha512-HJ44TJXtaGfGxVtljPECZvqw+GctVvBr60Rsedo5A+wU2GIiycJ8n5yUSdc9UiYTnPuxfJFicJec6kgR6GSWKA== +"@next/react-dev-overlay@10.0.1-canary.1": + version "10.0.1-canary.1" + resolved "https://registry.yarnpkg.com/@next/react-dev-overlay/-/react-dev-overlay-10.0.1-canary.1.tgz#a54785d2aeab8fd76a25196eabc15ca281173c42" + integrity sha512-LEOcvJ+EjivrN2Ce2FSTUcb5VbyyQ4cVe/Ie/ja4+NzHIMMMX49nqTZ3uW4PIlfaGtCjiMZC8I43OgrMI2eG6w== dependencies: "@babel/code-frame" "7.10.4" ally.js "1.4.1" @@ -1158,10 +1158,10 @@ stacktrace-parser "0.1.10" strip-ansi "6.0.0" -"@next/react-refresh-utils@10.0.0": - version "10.0.0" - resolved "https://registry.yarnpkg.com/@next/react-refresh-utils/-/react-refresh-utils-10.0.0.tgz#45cdd1ad3b55ac442f8431cdc43ff53c3dc44d16" - integrity sha512-V1/oiDWb2C1Do0eZONsKX1aqGNkqCUqxUahIiCjwKFu9c3bps+Ygg4JjtaCd9oycv0KzYImUZnU+nqveFUjxUw== +"@next/react-refresh-utils@10.0.1-canary.1": + version "10.0.1-canary.1" + resolved "https://registry.yarnpkg.com/@next/react-refresh-utils/-/react-refresh-utils-10.0.1-canary.1.tgz#ce11b740fe80c4a43462a695247577bceb39a3db" + integrity sha512-9Q0LQ3NJxP6YbYhWyNYCUxlcT7EzwSYwDJ7j3dsDQt9dLwMC8PNmDVN38zpcqDMavb6jOFtbJMivef2ZylieKw== "@npmcli/move-file@^1.0.1": version "1.0.1" @@ -4305,10 +4305,10 @@ next-tick@~1.0.0: resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c" integrity sha1-yobR/ogoFpsBICCOPchCS524NCw= -next@^10.0.0: - version "10.0.0" - resolved "https://registry.yarnpkg.com/next/-/next-10.0.0.tgz#fbc82fa69f05bf82fb5c4e160151f38fb9615e99" - integrity sha512-hpJkikt6tqwj7DfD5Mizwc1kDsaaS73TQK6lJL+++Ht8QXIEs+KUqTZULgdMk80mDV2Zhzo9/JYMEranWwAFLA== +next@^10.0.1-canary.1: + version "10.0.1-canary.1" + resolved "https://registry.yarnpkg.com/next/-/next-10.0.1-canary.1.tgz#fc68e0cfb04fce87dc81e8def09dc2cb916e106b" + integrity sha512-NG56oUFcX6AE+B8VFNXo6R1twWVGtj4037yNq+AI1zkQ3U7oWegZI+9KqjCi+4IzTvtl5tzkLvVxeaemEH+quA== dependencies: "@ampproject/toolbox-optimizer" "2.7.0-alpha.1" "@babel/code-frame" "7.10.4" @@ -4329,10 +4329,10 @@ next@^10.0.0: "@babel/runtime" "7.11.2" "@babel/types" "7.11.5" "@hapi/accept" "5.0.1" - "@next/env" "10.0.0" - "@next/polyfill-module" "10.0.0" - "@next/react-dev-overlay" "10.0.0" - "@next/react-refresh-utils" "10.0.0" + "@next/env" "10.0.1-canary.1" + "@next/polyfill-module" "10.0.1-canary.1" + "@next/react-dev-overlay" "10.0.1-canary.1" + "@next/react-refresh-utils" "10.0.1-canary.1" ast-types "0.13.2" babel-plugin-transform-define "2.0.0" babel-plugin-transform-react-remove-prop-types "0.4.24" From 7c9be7cf737f04313b23c9ae4cfe392b5e2cc0e4 Mon Sep 17 00:00:00 2001 From: Luis Alvarez Date: Thu, 29 Oct 2020 19:03:43 -0500 Subject: [PATCH 15/18] Only include pages that have a locale --- pages/[...pages].tsx | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/pages/[...pages].tsx b/pages/[...pages].tsx index ad67d581a..0b535bdfc 100644 --- a/pages/[...pages].tsx +++ b/pages/[...pages].tsx @@ -1,4 +1,8 @@ -import type { GetStaticPropsContext, InferGetStaticPropsType } from 'next' +import type { + GetStaticPathsContext, + GetStaticPropsContext, + InferGetStaticPropsType, +} from 'next' import { getConfig } from '@bigcommerce/storefront-data-hooks/api' import getPage from '@bigcommerce/storefront-data-hooks/api/operations/get-page' import getAllPages from '@bigcommerce/storefront-data-hooks/api/operations/get-all-pages' @@ -32,11 +36,21 @@ export async function getStaticProps({ } } -export async function getStaticPaths() { +export async function getStaticPaths({ locales }: GetStaticPathsContext) { const { pages } = await getAllPages() return { - paths: pages.map((page) => page.url).filter((url) => url), + paths: pages + .map((page) => page.url) + .filter((url) => { + if (!locales) return url + // If there are locales, only include the pages that include one of the available locales + if (url && locales.includes(getSlug(url).split('/')[0])) return url + + console.log( + `The page '${url}' does not include a locale, when using i18n web pages from BigCommerce are expected to have a locale or they will be ignored` + ) + }), // Fallback shouldn't be enabled here or otherwise this route // will catch every page, even 404s, and we don't want that fallback: false, From c70a965c7ddb6e405dbc1f2abd5bd23d74323a9e Mon Sep 17 00:00:00 2001 From: Luis Alvarez Date: Thu, 29 Oct 2020 19:21:46 -0500 Subject: [PATCH 16/18] Improved log and moved out of the page --- lib/usage-warns.ts | 22 ++++++++++++++++++++++ pages/[...pages].tsx | 24 +++++++++++++----------- 2 files changed, 35 insertions(+), 11 deletions(-) create mode 100644 lib/usage-warns.ts diff --git a/lib/usage-warns.ts b/lib/usage-warns.ts new file mode 100644 index 000000000..a81b6dc09 --- /dev/null +++ b/lib/usage-warns.ts @@ -0,0 +1,22 @@ +export function missingLocaleInPages(): [string[], () => void] { + const invalidPaths: string[] = [] + const log = () => { + if (invalidPaths.length) { + const single = invalidPaths.length === 0 + const pages = single ? 'page' : 'pages' + + console.log( + `The ${pages} "${invalidPaths.join(', ')}" ${ + single ? 'does' : 'do' + } not include a locale, when using i18n web pages from BigCommerce +are expected to have a locale or they will be ignored.\n +Please update the ${pages} to include the default locale or make the ${pages} invisible by +unchecking the "Navigation Menu" option in the settings of ${ + single ? 'the' : 'each' + } web page\n` + ) + } + } + + return [invalidPaths, log] +} diff --git a/pages/[...pages].tsx b/pages/[...pages].tsx index 0b535bdfc..ccd59932a 100644 --- a/pages/[...pages].tsx +++ b/pages/[...pages].tsx @@ -8,6 +8,7 @@ import getPage from '@bigcommerce/storefront-data-hooks/api/operations/get-page' import getAllPages from '@bigcommerce/storefront-data-hooks/api/operations/get-all-pages' import getSlug from '@lib/get-slug' import { Layout, HTMLContent } from '@components/core' +import { missingLocaleInPages } from '@lib/usage-warns' export async function getStaticProps({ preview, @@ -38,19 +39,20 @@ export async function getStaticProps({ export async function getStaticPaths({ locales }: GetStaticPathsContext) { const { pages } = await getAllPages() + const [invalidPaths, log] = missingLocaleInPages() + const paths = pages + .map((page) => page.url) + .filter((url) => { + if (!url || !locales) return url + // If there are locales, only include the pages that include one of the available locales + if (locales.includes(getSlug(url).split('/')[0])) return url + + invalidPaths.push(url) + }) + log() return { - paths: pages - .map((page) => page.url) - .filter((url) => { - if (!locales) return url - // If there are locales, only include the pages that include one of the available locales - if (url && locales.includes(getSlug(url).split('/')[0])) return url - - console.log( - `The page '${url}' does not include a locale, when using i18n web pages from BigCommerce are expected to have a locale or they will be ignored` - ) - }), + paths, // Fallback shouldn't be enabled here or otherwise this route // will catch every page, even 404s, and we don't want that fallback: false, From b06dca4243cd7c79df2493bd75acf6eee1ace398 Mon Sep 17 00:00:00 2001 From: Luis Alvarez Date: Thu, 29 Oct 2020 19:25:19 -0500 Subject: [PATCH 17/18] Added a comment --- lib/usage-warns.ts | 6 +++++- pages/[...pages].tsx | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/usage-warns.ts b/lib/usage-warns.ts index a81b6dc09..aa77f6304 100644 --- a/lib/usage-warns.ts +++ b/lib/usage-warns.ts @@ -1,8 +1,12 @@ +/** + * The utils here are used to help developers use the example + */ + export function missingLocaleInPages(): [string[], () => void] { const invalidPaths: string[] = [] const log = () => { if (invalidPaths.length) { - const single = invalidPaths.length === 0 + const single = invalidPaths.length === 1 const pages = single ? 'page' : 'pages' console.log( diff --git a/pages/[...pages].tsx b/pages/[...pages].tsx index ccd59932a..1457484fd 100644 --- a/pages/[...pages].tsx +++ b/pages/[...pages].tsx @@ -7,8 +7,8 @@ import { getConfig } from '@bigcommerce/storefront-data-hooks/api' import getPage from '@bigcommerce/storefront-data-hooks/api/operations/get-page' import getAllPages from '@bigcommerce/storefront-data-hooks/api/operations/get-all-pages' import getSlug from '@lib/get-slug' -import { Layout, HTMLContent } from '@components/core' import { missingLocaleInPages } from '@lib/usage-warns' +import { Layout, HTMLContent } from '@components/core' export async function getStaticProps({ preview, From c1db48bb665373f6fddff4766e600d59f98b58f3 Mon Sep 17 00:00:00 2001 From: Luis Alvarez Date: Thu, 29 Oct 2020 19:26:44 -0500 Subject: [PATCH 18/18] Clarification --- lib/usage-warns.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/usage-warns.ts b/lib/usage-warns.ts index aa77f6304..2033cd029 100644 --- a/lib/usage-warns.ts +++ b/lib/usage-warns.ts @@ -12,8 +12,8 @@ export function missingLocaleInPages(): [string[], () => void] { console.log( `The ${pages} "${invalidPaths.join(', ')}" ${ single ? 'does' : 'do' - } not include a locale, when using i18n web pages from BigCommerce -are expected to have a locale or they will be ignored.\n + } not include a locale, or the locale is not supported. When using i18n, web pages from +BigCommerce are expected to have a locale or they will be ignored.\n Please update the ${pages} to include the default locale or make the ${pages} invisible by unchecking the "Navigation Menu" option in the settings of ${ single ? 'the' : 'each'