-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(*): update to latest firebase/stencil
BREAKING CHANGE This will require an update of peer dependencies
- Loading branch information
realappie
committed
Nov 3, 2021
1 parent
1d5afa3
commit 492684e
Showing
15 changed files
with
1,810 additions
and
1,576 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
v10.13.0 | ||
v16 |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/components/picker-customer-logo/picker-customer-logo.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
:host { | ||
display: block; | ||
width: 75px; | ||
height: 75px; | ||
position: relative; | ||
} | ||
|
||
img, .placeholder { | ||
position: absolute; | ||
} | ||
|
||
img { | ||
width: 100%; | ||
height: 100%; | ||
display: block; | ||
border-radius: var(--border-radius); | ||
border: 1px solid var(--border-color); | ||
background-color: var(--background-color); | ||
z-index: 0; | ||
} | ||
|
||
.placeholder { | ||
width: 100%; | ||
height: 100%; | ||
background-color: var(--background-color); | ||
border: 1px solid var(--border-color); | ||
z-index: 1; | ||
transition: 300ms opacity; | ||
opacity: 1; | ||
} | ||
|
58 changes: 58 additions & 0 deletions
58
src/components/picker-customer-logo/picker-customer-logo.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { getDownloadURL } from '@firebase/storage'; | ||
import { Component, Host, h, Prop, State } from '@stencil/core'; | ||
import { ref } from 'firebase/storage'; | ||
import { firebaseServiceInstance } from '../../firebase'; | ||
|
||
@Component({ | ||
tag: 'picker-customer-logo', | ||
styleUrl: 'picker-customer-logo.scss', | ||
shadow: true, | ||
}) | ||
export class PickerCustomerLogo { | ||
|
||
@Prop() | ||
logoPath: string; | ||
|
||
@Prop() | ||
customerName: string; | ||
|
||
/** we will use this in the image tag */ | ||
@State() | ||
logoSrc: string; | ||
|
||
componentWillLoad() { | ||
this.loadImageSrc(); | ||
} | ||
|
||
private async loadImageSrc() { | ||
try { | ||
// const wait = (ms: number) => new Promise(resolve => setTimeout(resolve, ms)); | ||
|
||
// await wait(400000); | ||
this.logoSrc = await getDownloadURL(ref(firebaseServiceInstance.storage, this.logoPath)); | ||
} catch (error) { | ||
console.error(`[eva-picker-customer-logo] error getting customer logo for ${this.customerName}`, error); | ||
} | ||
} | ||
|
||
render() { | ||
return ( | ||
<Host> | ||
<div class="placeholder" style={{ | ||
'opacity': this.logoSrc ? '0' : '1', | ||
}}></div> | ||
|
||
{this.renderImage()} | ||
</Host> | ||
); | ||
} | ||
|
||
|
||
private renderImage() { | ||
if (this.logoSrc) { | ||
return <img src={this.logoSrc} alt={`logo of customer: ${this.customerName}`} /> | ||
} else { | ||
return <div></div>; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.