From f3e24812ffb72b55fce1c111535f866f6cffb318 Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 15 Dec 2023 10:26:34 +1100 Subject: [PATCH] Base64 Encoded fonts for storybook (#11347) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### WHY are these changes introduced? Base64 encode our Inter font dependencies for storybook so we can be sure that they're loaded immediately in chromatic 🤞 --- polaris-react/.storybook/preview-head.html | 25 ++++++++++++++++------ polaris-react/.storybook/preview.js | 13 ----------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/polaris-react/.storybook/preview-head.html b/polaris-react/.storybook/preview-head.html index 85efd5391ee..69a7d443bab 100644 --- a/polaris-react/.storybook/preview-head.html +++ b/polaris-react/.storybook/preview-head.html @@ -1,6 +1,19 @@ - - + diff --git a/polaris-react/.storybook/preview.js b/polaris-react/.storybook/preview.js index 5d1a2e37cba..ac485bda820 100644 --- a/polaris-react/.storybook/preview.js +++ b/polaris-react/.storybook/preview.js @@ -5,21 +5,8 @@ import enTranslations from '../locales/en.json'; import {GridOverlay} from './GridOverlay'; import {RenderPerformanceProfiler} from './RenderPerformanceProfiler'; import {gridOptions, featureFlagOptions} from './manager'; -import isChromatic from 'chromatic/isChromatic'; import {themeNameDefault, themeNames, themes} from '@shopify/polaris-tokens'; -// Use the document.fonts API to check if fonts have loaded -// https://developer.mozilla.org/en-US/docs/Web/API/Document/fonts API to -const fontLoader = async () => ({ - fonts: await document.fonts.ready, -}); - -/* 👇 It's configured as a global loader - * See https://storybook.js.org/docs/react/writing-stories/loaders - * to learn more about loaders - */ -export const loaders = isChromatic() && document.fonts ? [fontLoader] : []; - function StrictModeDecorator(Story, context) { const {strictMode} = context.globals; const Wrapper = strictMode ? React.StrictMode : React.Fragment;