-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
60 changed files
with
2,897 additions
and
2,485 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
--- | ||
title: "Web Component" | ||
--- | ||
|
||
# Web Component | ||
|
||
If your app is not using React, have no fear, the web component version of the Skip:Go Widget is here! | ||
|
||
In order to register the web-component, you must first call the `initializeSwapWidget` function: | ||
```tsx | ||
import { initializeSwapWidget } from '@skip-go/widget'; | ||
initializeSwapWidget(); | ||
``` | ||
et voilà! you can now use the `swap-widget` web-component as `<swap-widget></swap-widget>`. | ||
The props for the web component are the same as `SwapWidgetProps` except that all props | ||
are passed to the web-component via attributes in kebab-case as strings or stringified objects. Example below: | ||
```tsx | ||
<div | ||
style={{ | ||
width: '450px', | ||
height: '820px', | ||
}} | ||
> | ||
<SwapWidget | ||
className="test-class" | ||
onlyTestnet={true} | ||
colors={{ | ||
primary: '#FF4FFF', | ||
}} | ||
defaultRoute={{ | ||
srcChainID: 'osmosis-1', | ||
srcAssetDenom: | ||
'ibc/1480b8fd20ad5fcae81ea87584d269547dd4d436843c1d20f15e00eb64743ef4', | ||
}} | ||
/> | ||
</div> | ||
``` | ||
becomes | ||
```tsx | ||
<div style="width:450px;height:820px;"> | ||
<swap-widget | ||
class-name="test-class" | ||
onlyTestnet="true" | ||
colors='{"primary":"#FF4FFF"}' | ||
default-route={JSON.stringify({ | ||
srcChainID: 'osmosis-1', | ||
srcAssetDenom: | ||
'ibc/1480b8fd20ad5fcae81ea87584d269547dd4d436843c1d20f15e00eb64743ef4', | ||
})} | ||
></swap-widget> | ||
</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
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,48 @@ | ||
import { NextPage } from 'next'; | ||
import React from 'react'; | ||
import { SwapWidgetWithoutProviders } from '@skip-go/widget'; | ||
import { SwapWidgetProvider } from '@skip-go/widget'; | ||
|
||
const Home: NextPage = () => { | ||
return ( | ||
<div | ||
style={{ | ||
display: 'flex', | ||
flexDirection: 'row', | ||
}} | ||
> | ||
<div | ||
style={{ | ||
width: '450px', | ||
height: '820px', | ||
}} | ||
> | ||
<SwapWidgetProvider> | ||
<SwapWidgetWithoutProviders | ||
defaultRoute={{ | ||
srcChainID: 'osmosis-1', | ||
srcAssetDenom: | ||
'ibc/1480b8fd20ad5fcae81ea87584d269547dd4d436843c1d20f15e00eb64743ef4', | ||
}} | ||
/> | ||
</SwapWidgetProvider> | ||
</div> | ||
<button | ||
onClick={() => { | ||
if (window.confirm('Are you sure you want to purge all settings?')) { | ||
window.localStorage.clear(); | ||
window.sessionStorage.clear(); | ||
window.location.reload(); | ||
} | ||
}} | ||
style={{ | ||
height: '40px', | ||
}} | ||
> | ||
Purge Settings | ||
</button> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Home; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,4 @@ div, | |
p, | ||
span { | ||
color: gray; | ||
border: 2px solid gray; | ||
background: gray; | ||
} |
Oops, something went wrong.