From 25ce316ae1ab0ade83de4f0533584af729823e2a Mon Sep 17 00:00:00 2001 From: giannif Date: Thu, 23 Jun 2022 14:14:20 -0700 Subject: [PATCH] add env variable to stop fonts from loading --- packages/brand/README.md | 4 +++- packages/brand/src/typography.ts | 6 ++++-- packages/components/README.md | 2 ++ packages/react-components/README.md | 3 +++ 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/brand/README.md b/packages/brand/README.md index 96e7b714..3e32382c 100644 --- a/packages/brand/README.md +++ b/packages/brand/README.md @@ -1,3 +1,5 @@ # @giphy/js-brand -Colors, fonts - WIP +Colors, fonts + +To stop fonts from loading set the environment variable `GIPHY_SDK_NO_FONTS=true`, this is not recommended as it could cause inconsistencies in the ui components diff --git a/packages/brand/src/typography.ts b/packages/brand/src/typography.ts index 348c77b1..01a4c4ee 100644 --- a/packages/brand/src/typography.ts +++ b/packages/brand/src/typography.ts @@ -1,7 +1,6 @@ import { css, cx, injectGlobal } from 'emotion' -// eslint-disable-next-line -injectGlobal` +export const addFonts = () => injectGlobal` @font-face { font-family: 'interface'; font-style: normal; @@ -43,6 +42,9 @@ injectGlobal` src: url('https://s3.amazonaws.com/giphyscripts/react-giphy-brand/fonts/ss-social.woff') format('woff'); } ` +if (!process.env.GIPHY_SDK_NO_FONTS) { + addFonts() +} export const fontFamily = { title: "'nexablack', sans-serif", diff --git a/packages/components/README.md b/packages/components/README.md index 1a2d9b37..785ee7db 100644 --- a/packages/components/README.md +++ b/packages/components/README.md @@ -205,3 +205,5 @@ If a GIF has an associated user, an overlay with their avatar and display name w ``` ``` + +To stop fonts from loading set the environment variable `GIPHY_SDK_NO_FONTS=true`, this is not recommended as it could cause inconsistencies in the ui components diff --git a/packages/react-components/README.md b/packages/react-components/README.md index 4ef3a34e..fc169ac0 100644 --- a/packages/react-components/README.md +++ b/packages/react-components/README.md @@ -324,3 +324,6 @@ If you want to prefetch network requests before the loader appears in Grids and | onGifClick | `(gif: IGif, e: SyntheticEvent) => void` | fired when the gif is clicked | | onGifRightClick | `(gif: IGif, e: SyntheticEvent) => void` | fired when the gif is right clicked | | onGifKeyPress | `(gif: IGif, e: SyntheticEvent) => void` | fired when the a key is pressed on the gif | + + +To stop fonts from loading set the environment variable `GIPHY_SDK_NO_FONTS=true`, this is not recommended as it could cause inconsistencies in the ui components \ No newline at end of file