diff --git a/.storybook/withServicesDecorator/index.tsx b/.storybook/withServicesDecorator/index.tsx index 19faf9b1a1b..12afa532f78 100644 --- a/.storybook/withServicesDecorator/index.tsx +++ b/.storybook/withServicesDecorator/index.tsx @@ -54,9 +54,9 @@ export default (overrideProps?: { defaultService?: Services }) => ) => { const defaultServiceOverride = overrideProps?.defaultService; const serviceToUse = defaultServiceOverride || selectedService; - + console.log('HELLO', serviceToUse, '2', selectedService); const variant = getVariant(serviceToUse as Services)(TEXT_VARIANTS); - + console.log(variant); const service = variant ? getService(serviceToUse as Services)(TEXT_VARIANTS) : serviceToUse; diff --git a/.storybook/withServicesDecorator/text-variants.ts b/.storybook/withServicesDecorator/text-variants.ts index c5beb733fde..7eba5467c6b 100644 --- a/.storybook/withServicesDecorator/text-variants.ts +++ b/.storybook/withServicesDecorator/text-variants.ts @@ -1,3 +1,4 @@ +import serbian from '#app/lib/config/services/serbian'; import { Services, Variants } from '#app/models/types/global'; type TextVariant = { @@ -286,6 +287,9 @@ const TEXT_VARIANTS: Record = { timezone: 'GMT', articlePath: '/russian/articles/ck7pz7re3zgo', }, + serbian: { + variant: 'cyr', + }, serbianCyr: { service: 'serbian', variant: 'cyr', diff --git a/src/app/components/Header/ScriptLink/index.tsx b/src/app/components/Header/ScriptLink/index.tsx index f47e971704d..1a5f11a4187 100644 --- a/src/app/components/Header/ScriptLink/index.tsx +++ b/src/app/components/Header/ScriptLink/index.tsx @@ -59,15 +59,23 @@ const ScriptLink = ({ scriptSwitchId = '' }) => { const { service, scriptLink } = useContext(ServiceContext); const { isNextJs } = useContext(RequestContext); const { enabled: scriptLinkEnabled } = useToggle('scriptLink'); - + const isStoryBook = process.env.STORYBOOK; + let path; + let params; // TODO: Next.JS doesn't support `react-router-dom` hooks, so we need to // revisit this to support both Express and Next.JS in the future. if (!scriptLinkEnabled || isNextJs) return null; // eslint-disable-next-line react-hooks/rules-of-hooks - const { path, params }: UseRouteMatcher = useRouteMatch(); + if (!isStoryBook) { + // eslint-disable-next-line react-hooks/rules-of-hooks + const match = useRouteMatch(); + path = match.path; + params = match.params; + } + const { text, variant } = scriptLink || {}; + console.log('hello?123', isStoryBook); if (!variant) return null; - return ( { const featureToggle = useContext(ToggleContext).toggleState[toggleName]; const { enabled = null, value } = featureToggle || {}; - + console.log('maybe??', featureToggle, enabled); if (featureToggle) { return { ...{ enabled, value }, diff --git a/src/app/legacy/containers/Brand/index.jsx b/src/app/legacy/containers/Brand/index.jsx index 41832abe35f..cae87d97d90 100644 --- a/src/app/legacy/containers/Brand/index.jsx +++ b/src/app/legacy/containers/Brand/index.jsx @@ -28,7 +28,6 @@ const BrandContainer = ({ const svgRatio = brandSVG && brandSVG.ratio; const minWidth = svgRatio * svgMinHeight; const maxWidth = svgRatio * svgMaxHeight; - return ( { const [showConsentBanner, setShowConsentBanner] = useState(true); - + console.log('HELLO23', scriptLink); const handleBannerBlur = event => { const isRejectButton = event.target?.getAttribute('data-terms-banner') === 'reject' || @@ -49,7 +49,7 @@ const HeaderContainer = ({ const { service, script, translations, dir, scriptLink, lang, serviceLang } = useContext(ServiceContext); const { skipLinkText } = translations; - + console.log(renderScriptSwitch); const isOperaMini = useOperaMiniDetection(); const brandRef = useRef(null); @@ -78,7 +78,7 @@ const HeaderContainer = ({ shouldRenderScriptSwitch = true; } } - + console.log('render?', shouldRenderScriptSwitch); if (isApp) return null; return ( diff --git a/src/app/legacy/containers/Header/index.stories.jsx b/src/app/legacy/containers/Header/index.stories.jsx index c736c961187..a42b5da4e36 100644 --- a/src/app/legacy/containers/Header/index.stories.jsx +++ b/src/app/legacy/containers/Header/index.stories.jsx @@ -1,7 +1,29 @@ import React from 'react'; import HeaderContainer from '.'; +import { ServiceContext } from '#app/contexts/ServiceContext'; +import { ToggleContextProvider } from '#contexts/ToggleContext'; -const Component = () => ; +const Component = () => { + return ( + + + + + + ); +}; export default { title: 'Containers/Header', diff --git a/src/app/legacy/psammead/psammead-brand/src/index.jsx b/src/app/legacy/psammead/psammead-brand/src/index.jsx index cdbcc248922..a11e73d9967 100644 --- a/src/app/legacy/psammead/psammead-brand/src/index.jsx +++ b/src/app/legacy/psammead/psammead-brand/src/index.jsx @@ -175,7 +175,7 @@ const Brand = forwardRef((props, ref) => { linkId = null, ...rest } = props; - + console.log('final?', scriptLink); return ( { )} {skipLink} - {scriptLink &&
{scriptLink}
} + {scriptLink &&
{scriptLink}
}
);