Skip to content

Commit

Permalink
Merge pull request #8 from phase2/Phase2-Sprint6-4
Browse files Browse the repository at this point in the history
Phase2-Sprint6-4
  • Loading branch information
aellison authored Nov 25, 2024
2 parents 6aa63a0 + 3263404 commit 070443c
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 19 deletions.
37 changes: 25 additions & 12 deletions src/components/outline-yext-vertical/teaser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@ export function displayTeaser(vertical: string, result: verticalSearchResult) {
const teaserFunctions = {
healthcare_professionals: () =>
healthcareProfessionalTeaser(
result.data.address,
result.data.headshot?.url,
title,
url,
highlightField('c_specialties') || []
result.data["c_specialties"] || [],
),
testimonial: () =>
testimonialTeaser(result.data.c_testimonial_Photo, title, url, cleanData),
person: () => personTeaser(result.data.c_person_Photos, title, url, highlightField('c_title')),
person: () => personTeaser(result.data.c_person_Photos, title, url, highlightField('c_title'), cleanData),
page: () => defaultTeaser(highlightField('c_title'), url, cleanData),
locationsearch: () =>
locationTeaser(
Expand Down Expand Up @@ -91,10 +92,11 @@ export function defaultTeaser(title: string, url: string, snippet: string) {
></outline-teaser>`;
}

export function personTeaser(image: string, title: string, url: string, snippet: string) {
export function personTeaser(image: string, title: string, url: string, subtitle: string, snippet: string) {
return html`<outline-teaser
url="${url}"
title="${title}"
subtitle="${subtitle}"
image="${image}"
snippet="${snippet}"
></outline-teaser>`;
Expand All @@ -117,21 +119,32 @@ export function newsTeaser(
}

export function healthcareProfessionalTeaser(
address: Address | undefined,
image: string | undefined,
title: string,
url: string,
specialties: string[]
) {
return html`
<outline-teaser image="${image}" title="${title}" url="${url}">
${specialties.length > 0
? html`
<ul class="specialty-list">
${specialties.map(
(el: string) => html`<li class="specialty">${el}</li>`
)}
</ul>
`
<outline-teaser teaser-type="healthcare_professional" image="${image}" title="${title}" url="${url}">
${specialties.length > 0
? html`
<ul class="specialty-list">
<li class="specialty">
${specialties.map((el: string, index: number) => html`
${el}${index < specialties.length - 1 ? ',' : ''}
`)}
</li>
</ul>
`
: null}
${address
? unsafeHTML(`
<div slot="address">
${address.line1}<br />
${address.city}, ${address.region} ${address.postalCode}<br />
</div>
`)
: null}
<outline-button
slot="cta"
Expand Down
4 changes: 4 additions & 0 deletions src/components/shared/outline-teaser/outline-teaser.css
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,7 @@
.highlight {
font-weight: bold;
}

.address-padding-top {
padding-top: 0.5rem;
}
24 changes: 17 additions & 7 deletions src/components/shared/outline-teaser/outline-teaser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ export class OutlineTeaser extends LitElement {
@property({ type: String, attribute: 'date' })
teaserDate?: string;

@property({ type: String, attribute: 'teaser-type' })
teaserType?: string;

@state() hasAddressSlot?: boolean;
@state() hasCtaSlot?: boolean;

Expand All @@ -64,12 +67,18 @@ export class OutlineTeaser extends LitElement {
<div class="location-information">
<div class="inner">
${this.hasAddressSlot
? html`
<h4>Location</h4>
<div class="address">
<slot name="address"></slot>
</div>
`
? this.teaserType != 'healthcare_professional'
? html`
<h4>Location</h4>
<div class="address">
<slot name="address"></slot>
</div>
`
: html`
<div class="address address-padding-top">
<slot name="address"></slot>
</div>
`
: null}
${this.teaserPhone
? html`<a href="tel:${this.teaserPhone}" class="phone" title=""
Expand Down Expand Up @@ -125,7 +134,7 @@ export class OutlineTeaser extends LitElement {
`
: null}
${this.teaserSubtitle
? html` <div class="subtitle">${this.teaserSubtitle}</div> `
? html` <div class="subtitle">${unsafeHTML(this.teaserSubtitle)}</div> `
: null}
<div
Expand All @@ -134,6 +143,7 @@ export class OutlineTeaser extends LitElement {
'has-hours': this.teaserHours,
'is-mobile': isMobile,
})}"
title=""
>
${this.teaserSnippet
? html`${unsafeHTML(this.teaserSnippet)}`
Expand Down

0 comments on commit 070443c

Please sign in to comment.