-
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.
Docs Theming and Web Component Update (#80)
- Loading branch information
1 parent
a90c994
commit 165c52f
Showing
4 changed files
with
75 additions
and
51 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
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> | ||
``` |