diff --git a/stories/Atom/Typography/Heading/Heading.jsx b/stories/Atom/Typography/Heading/Heading.jsx index b019f456a..42e289c4b 100644 --- a/stories/Atom/Typography/Heading/Heading.jsx +++ b/stories/Atom/Typography/Heading/Heading.jsx @@ -1,5 +1,5 @@ -import React from 'react'; -import '../../../assets/scss/_typography.scss'; +import React from "react"; +import "../../../assets/scss/_typography.scss"; export function Heading({ type, @@ -14,8 +14,26 @@ export function Heading({ const heading_classes = className ?? ''; return ( - + {label} ); + + function getSize() { + const MAX_SIZE = 8; + // there are more words + if (label.indexOf(' ') !== -1) { + return 4; // 4vw + } + + // => there is only one word + if (label.length < 5) { + return 8; // 8vw + } + + const WORD_LENGTH = label.length; + const WORD_SIZE = WORD_LENGTH * (0.88 ** WORD_LENGTH); + if (WORD_SIZE > MAX_SIZE) return MAX_SIZE; + return WORD_SIZE; + } } diff --git a/stories/Components/UIcomponents/Hero/PageHero/PageHeroOption.jsx b/stories/Components/UIcomponents/Hero/PageHero/PageHeroOption.jsx index c25a02925..bf0d0aaad 100644 --- a/stories/Components/UIcomponents/Hero/PageHero/PageHeroOption.jsx +++ b/stories/Components/UIcomponents/Hero/PageHero/PageHeroOption.jsx @@ -27,7 +27,7 @@ export function PageHeroOption({
{args.Overline == 'On' && content && } - + {args.Subtitle == 'On' && subtitle &&

{subtitle}

} {args.CTA == 'On' && cta.label && }
@@ -39,7 +39,7 @@ export function PageHeroOption({ ) : ( - {imgalt} )}