-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
<!--- Provide a general summary of your changes in the Title above --> ## Description <!--- Describe your changes in detail --> Implenentation of loader overlay ## Related Issue Or Context <!--- If suggesting a new feature or change, please discuss it in an issue first --> <!--- If fixing a bug, there should be an issue describing it with steps to reproduce --> <!--- Otherwise, describe context and motivation for change here --> Closes: #66 ## How Has This Been Tested? Testing details. <!--- Please describe in detail how you tested your changes. --> <!--- Include details of your testing environment, and the tests you ran to --> <!--- see how your change affects other areas of the code, etc. --> ## Types of changes <!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [ ] Bug fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation ## Checklist: <!--- Go over all the following points, and put an `x` in all the boxes that apply. --> <!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> - [ ] I have commented my code, particularly in hard-to-understand areas. - [ ] I have ensured that all acceptance criteria (or expected behavior) from issue are met - [ ] I have updated the documentation locally and in sygma-docs. - [ ] I have added tests to cover my changes. - [ ] I have ensured that all the checks are passing and green, I've signed the CLA bot
- Loading branch information
Showing
8 changed files
with
108 additions
and
4 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,4 +1,5 @@ | ||
export { AmountSelector } from './amount-selector'; | ||
export { NetworkSelector } from './network-selector'; | ||
export { OverlayComponent } from './overlay-component'; | ||
export { ConnectWalletButton } from './buttons'; | ||
export { AddressInput } from './address-input'; |
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 @@ | ||
export { OverlayComponent } from './overlay-component'; |
22 changes: 22 additions & 0 deletions
22
packages/widget/src/components/overlay-component/overlay-component.ts
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,22 @@ | ||
import { html } from 'lit'; | ||
import type { HTMLTemplateResult } from 'lit'; | ||
import { customElement } from 'lit/decorators.js'; | ||
import { BaseComponent } from '../base-component/base-component'; | ||
import { styles } from './styles'; | ||
|
||
@customElement('sygma-overlay-component') | ||
export class OverlayComponent extends BaseComponent { | ||
static styles = styles; | ||
|
||
render(): HTMLTemplateResult { | ||
return html` <div class="overlay"> | ||
<div class="loadingSpinner"></div> | ||
</div>`; | ||
} | ||
} | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
'sygma-overlay-component': OverlayComponent; | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
packages/widget/src/components/overlay-component/styles.ts
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,35 @@ | ||
import { css } from 'lit'; | ||
|
||
export const styles = css` | ||
.overlay { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
background-color: rgba(255, 255, 255, 0.7); | ||
border-radius: 0.75rem; | ||
} | ||
.loadingSpinner { | ||
border: 0.25rem solid var(--blue-600); | ||
border-top: 0.25rem solid var(--white); | ||
border-radius: 50%; | ||
width: 4rem; | ||
height: 4rem; | ||
animation: spin 1s linear infinite; | ||
} | ||
@keyframes spin { | ||
0% { | ||
transform: rotate(0deg); | ||
} | ||
100% { | ||
transform: rotate(360deg); | ||
} | ||
} | ||
`; |
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
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
25 changes: 25 additions & 0 deletions
25
packages/widget/tests/unit/components/overlay-component/overlay-component.test.ts
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,25 @@ | ||
import { afterEach, assert, describe, it } from 'vitest'; | ||
import { fixture, fixtureCleanup } from '@open-wc/testing-helpers'; | ||
import { html } from 'lit'; | ||
import { OverlayComponent } from '../../../../src/components'; | ||
|
||
describe('loader-component', function () { | ||
afterEach(() => { | ||
fixtureCleanup(); | ||
}); | ||
|
||
it('is defined', () => { | ||
const el = document.createElement('sygma-overlay-component'); | ||
assert.instanceOf(el, OverlayComponent); | ||
}); | ||
|
||
it('renders loader', async () => { | ||
const el = await fixture(html` | ||
<sygma-overlay-component></sygma-overlay-component> | ||
`); | ||
|
||
const overlay = el.shadowRoot!.querySelector('.overlay') as HTMLElement; | ||
|
||
assert.isNotNull(overlay); | ||
}); | ||
}); |