Skip to content

Commit f5106bc

Browse files
committed
feat: adds get-company-logo and mark helpers
1 parent 76dfda0 commit f5106bc

3 files changed

Lines changed: 16 additions & 8 deletions

File tree

packages/web/leavitt/company-select/company-select.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { TitaniumSingleSelectBase } from '../../titanium/single-select-base/sing
1414

1515
import { Debouncer } from '../../titanium/helpers/debouncer';
1616
import { ShowSnackbarEvent } from '../../titanium/snackbar/show-snackbar-event';
17+
import { getCompanyMark } from '@leavittsoftware/web/titanium/helpers/get-company-mark';
1718

1819
/**
1920
* Single select input that searches Leavitt Group companies
@@ -62,14 +63,7 @@ export class LeavittCompanySelect extends TitaniumSingleSelectBase<Partial<Compa
6263
<slot name="trailing-icon" slot="trailing-icon"></slot>
6364
<span slot="headline">${company.Name}</span>
6465
<span slot="supporting-text">${company.ShortName || '-'}</span>
65-
<img
66-
loading="lazy"
67-
company-mark
68-
slot="start"
69-
src=${this.themePreference == 'dark'
70-
? company?.DarkMarkUrl || company?.MarkUrl || 'https://cdn.leavitt.com/lg-mark-dark.svg'
71-
: company?.MarkUrl || 'https://cdn.leavitt.com/lg-mark.svg'}
72-
/>
66+
<img loading="lazy" company-mark slot="start" src=${getCompanyMark(company, this.themePreference)} />
7367
</md-menu-item>`;
7468

7569
async firstUpdated() {
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { Company } from '@leavittsoftware/lg-core-typescript';
2+
3+
export function getCompanyLogo(company: Partial<Company> | null, themePreference: 'light' | 'dark') {
4+
return themePreference == 'dark'
5+
? company?.DarkLogoUrl || company?.LogoUrl || 'https://cdn.leavitt.com/lg-logo-dark.svg'
6+
: company?.LogoUrl || 'https://cdn.leavitt.com/lg-logo.svg';
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { Company } from '@leavittsoftware/lg-core-typescript';
2+
3+
export function getCompanyMark(company: Partial<Company> | null, themePreference: 'light' | 'dark') {
4+
return themePreference == 'dark'
5+
? company?.DarkMarkUrl || company?.MarkUrl || 'https://cdn.leavitt.com/lg-mark-dark.svg'
6+
: company?.MarkUrl || 'https://cdn.leavitt.com/lg-mark.svg';
7+
}

0 commit comments

Comments
 (0)