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

View file

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

View file

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