Merge pull request #983 from Safelite/feature/humphries/alignment-fix

Fix justification issue in subheader component
This commit is contained in:
AHumphriesSL 2025-12-12 15:29:20 -05:00 committed by GitHub
commit 8390d9c49e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 28 additions and 28 deletions

View file

@ -3,7 +3,7 @@
<div <div
class="subheader-primary d-flex overflow-hidden"> class="subheader-primary d-flex overflow-hidden">
<h5 <h5
:class="[justifySubheaderSubText, headerColor]" :class="[justifySubheader, headerColor]"
class="fw-normal mb-0 subheader-primary"> class="fw-normal mb-0 subheader-primary">
<span> <span>
{{ content }} {{ content }}
@ -15,13 +15,13 @@
</h5> </h5>
</div> </div>
<div <div
v-if="hasSubText" v-if="hasSecondaryText"
:class="[justifySubheader, subHeaderClasses, subHeaderMarginClasses]" :class="[justifySubheaderSecondaryText, subHeaderClasses, subHeaderMarginClasses]"
class="subheader-secondary d-flex align-items-center overflow-hidden"> class="subheader-secondary d-flex align-items-start overflow-hidden">
<p <p
class="dark-header" class="dark-header"
:class="[alternateFormatting, subTextClasses]"> :class="[alternateFormatting, secondaryTextClasses]">
<span v-html="subText"> </span> <span v-html="secondaryText"> </span>
</p> </p>
</div> </div>
</div> </div>
@ -49,7 +49,7 @@ export default {
hasBackButton: Boolean, hasBackButton: Boolean,
issContainingPage: String, issContainingPage: String,
justification: String, justification: String,
justificationSubText: String, justificationSecondaryText: String,
stripRteStyle: Boolean, stripRteStyle: Boolean,
subContentProperty: String, subContentProperty: String,
subHeaderClasses: String, subHeaderClasses: String,
@ -57,7 +57,7 @@ export default {
type: String, type: String,
default: 'mt-1' default: 'mt-1'
}, },
subTextClasses: String secondaryTextClasses: String
}, },
emits: ['click-event'], emits: ['click-event'],
computed: { computed: {
@ -67,33 +67,33 @@ export default {
this.contentProperty ?? 'SubHeaderText' this.contentProperty ?? 'SubHeaderText'
); );
}, },
subText() { secondaryText() {
let subTextFromCms = this.getCmsContent( let secondaryTextFromCms = this.getCmsContent(
this.cmsWidgetName, this.cmsWidgetName,
this.subContentProperty ?? 'SecondaryText' this.subContentProperty ?? 'SecondaryText'
); );
if (this.stripRteStyle) { if (this.stripRteStyle) {
subTextFromCms = stripRteStyle(subTextFromCms); secondaryTextFromCms = stripRteStyle(secondaryTextFromCms);
} }
let subText = ''; let secondaryText = '';
if (this.doesCopyContainRouterLink(subTextFromCms)) { if (this.doesCopyContainRouterLink(secondaryTextFromCms)) {
splitCopyOnCMSPlaceHolder(subTextFromCms).forEach((sc) => { splitCopyOnCMSPlaceHolder(secondaryTextFromCms).forEach((sc) => {
if (this.doesCopyContainRouterLink(sc)) { if (this.doesCopyContainRouterLink(sc)) {
subText += getRouterLinkHtmlStringFromCopy(sc); secondaryText += getRouterLinkHtmlStringFromCopy(sc);
} else { } else {
subText += sc; secondaryText += sc;
} }
}); });
} else { } else {
subText = subTextFromCms; secondaryText = secondaryTextFromCms;
} }
return subText ?? ''; return secondaryText ?? '';
}, },
hasSubText() { hasSecondaryText() {
return this.subText.length > 0; return this.secondaryText.length > 0;
}, },
backButtonAccessibleText() { backButtonAccessibleText() {
return this.getCmsContent( return this.getCmsContent(
@ -102,15 +102,15 @@ export default {
); );
}, },
headerColor() { headerColor() {
return this.subText ? 'dark-header' : 'light-header'; return this.secondaryText ? 'dark-header' : 'light-header';
}, },
justifySubheader() { justifySubheader() {
return this.justification?.toLowerCase() === 'left' return this.justification?.toLowerCase() === 'center'
? 'justify-content-left' ? 'justify-content-center'
: 'justify-content-center'; : 'justify-content-left';
}, },
justifySubheaderSubText() { justifySubheaderSecondaryText() {
return this.justificationSubText?.toLowerCase() === 'center' return this.justificationSecondaryText?.toLowerCase() === 'center'
? 'justify-content-center' ? 'justify-content-center'
: 'justify-content-left'; : 'justify-content-left';
}, },

View file

@ -15,7 +15,7 @@
<siteSubHeader <siteSubHeader
class="mb-5 mt-4 px-3" class="mb-5 mt-4 px-3"
cmsWidgetName="SiteSubHeaderWidget" cmsWidgetName="SiteSubHeaderWidget"
subTextClasses="text-center" secondaryTextClasses="text-center"
subHeaderClasses="mt-4" /> subHeaderClasses="mt-4" />
<div class="main-content-container"> <div class="main-content-container">
<hr class="my-0" /> <hr class="my-0" />

View file

@ -14,7 +14,7 @@
<div class="schedule-page-container iss-heritage-content-container-width"> <div class="schedule-page-container iss-heritage-content-container-width">
<siteSubHeader <siteSubHeader
cmsWidgetName="ScheduleSubHeaderWidget" cmsWidgetName="ScheduleSubHeaderWidget"
subTextClasses="text-center small sub-text" secondaryTextClasses="text-center small sub-text"
class="mt-4" /> class="mt-4" />
<template v-if="ChangeShopLink.length"> <template v-if="ChangeShopLink.length">
<textBlock <textBlock