Skip to content

Commit

Permalink
Merge pull request #7 from phase2/Phase2-Sprint6-3
Browse files Browse the repository at this point in the history
Phase2-Sprint6-3
  • Loading branch information
aellison authored Nov 18, 2024
2 parents 5e815c4 + 08dbd3b commit 6aa63a0
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ export class OutlineYextUniversal extends LitElement {
'healthcare_professionals': 'Healthcare Professional',
'locationsearch': 'Location',
'news': 'News',
'page': 'Page',
'page': 'Other',
'person': 'Person',
'procedure': 'Procedure',
'service': 'Health Service',
Expand Down
25 changes: 21 additions & 4 deletions src/components/outline-yext-vertical/teaser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ export function displayTeaser(vertical: string, result: verticalSearchResult) {
? highlightText(result.highlightedFields[field])
: result.data[field];

const cleanData = highlightField('s_snippet');
const cleanDataUnformatted = highlightField('s_snippet');
const cleanData = (cleanDataUnformatted ?? '').replace(//g, ' ');
const startDate = highlightField('c_classes_events_start_date');
const date = startDate ? formatDate(startDate) : startDate
const title = highlightField('name');

const url = result.data.c_url
Expand All @@ -27,7 +30,7 @@ export function displayTeaser(vertical: string, result: verticalSearchResult) {
result.data.headshot?.url,
title,
url,
result.data.c_specialties?.map(highlightField) || []
highlightField('c_specialties') || []
),
testimonial: () =>
testimonialTeaser(result.data.c_testimonial_Photo, title, url, cleanData),
Expand All @@ -51,6 +54,8 @@ export function displayTeaser(vertical: string, result: verticalSearchResult) {
result.data.c_author || '',
result.data.c_authorCreatedDate
),
'classes-and-events': () =>
defaultTeaser( startDate ? `${title} | ${date}` : title, url, cleanData),
};

return (
Expand Down Expand Up @@ -131,7 +136,7 @@ export function healthcareProfessionalTeaser(
<outline-button
slot="cta"
button-url="${url}"
button-title="Request an appointment from profile"
button-title="Request Appointment"
></outline-button>
</outline-teaser>
`;
Expand All @@ -147,7 +152,6 @@ export function testimonialTeaser(
<outline-teaser
image="${image}"
title="${title}"
subtitle="Patient Testimonial"
snippet="${snippet}"
url="${url}"
></outline-teaser>
Expand Down Expand Up @@ -220,3 +224,16 @@ function highlightText(content: HighlightedField): string {

return highlightedText;
}

function formatDate(dateString: string): string {
const date = new Date(dateString);
const options: Intl.DateTimeFormatOptions = {
year: 'numeric',
month: 'long',
day: 'numeric',
hour: 'numeric',
minute: 'numeric',
hour12: true,
};
return new Intl.DateTimeFormat('en-US', options).format(date);
}
19 changes: 10 additions & 9 deletions src/components/shared/outline-teaser/outline-teaser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ export class OutlineTeaser extends LitElement {
`
: null}
${this.teaserPhone
? html`<a href="tel:${this.teaserPhone}" class="phone"
? html`<a href="tel:${this.teaserPhone}" class="phone" title=""
>${this.teaserPhone}</a
>`
: null}
${this.teaserFax ? html` <p class="fax">${this.teaserFax}</p>` : null}
${this.teaserDirectionsUrl
? html` <a class="directions" href="${this.teaserDirectionsUrl}">
? html` <a class="directions" title="" href="${this.teaserDirectionsUrl}">
Get directions
</a>`
: null}
Expand Down Expand Up @@ -110,7 +110,7 @@ export class OutlineTeaser extends LitElement {
<div class="content">
<h3 class="title">
<a href="${this.teaserUrl}">${unsafeHTML(this.teaserTitle)}</a>
<a href="${this.teaserUrl}" title="">${unsafeHTML(this.teaserTitle)}</a>
</h3>
${this.teaserAuthor || this.teaserDate
Expand Down Expand Up @@ -140,12 +140,13 @@ export class OutlineTeaser extends LitElement {
: html`<slot></slot>`}
${this.locationInformationTemplate()}
${this.teaserHours
? html`
<div class="hours">
<h4>Hours</h4>
${unsafeHTML(this.teaserHours)}
</div>
`
? null
// html`
// <div class="hours">
// <h4>Hours</h4>
// ${unsafeHTML(this.teaserHours)}
// </div>
// `
: null}
${this.hasCtaSlot
? html`
Expand Down

0 comments on commit 6aa63a0

Please sign in to comment.