Skip to content

[FRE-1668] Update web-component to allow passing props in the same format as the react component (camelCase) #1055

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Apr 15, 2025

Conversation

toddkao
Copy link
Collaborator

@toddkao toddkao commented Apr 11, 2025

No description provided.

Copy link

changeset-bot bot commented Apr 11, 2025

🦋 Changeset detected

Latest commit: acf8420

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@skip-go/widget Patch
nextjs Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Apr 11, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
widget-nextjs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 14, 2025 8:26pm

@toddkao toddkao changed the title WIP Fix web-component to allow passing functions Apr 11, 2025
@toddkao toddkao marked this pull request as draft April 11, 2025 17:58
@toddkao toddkao changed the title Fix web-component to allow passing functions [FRE-1668] Fix web-component to allow passing functions Apr 14, 2025
@toddkao toddkao marked this pull request as ready for review April 14, 2025 18:46
@toddkao toddkao changed the title [FRE-1668] Fix web-component to allow passing functions [FRE-1668] Fix web-component to allow passing props in the same format as the react component (camelCase) Apr 14, 2025
@toddkao toddkao changed the title [FRE-1668] Fix web-component to allow passing props in the same format as the react component (camelCase) [FRE-1668] Update web-component to allow passing props in the same format as the react component (camelCase) Apr 14, 2025
Comment on lines +73 to +74
interface HTMLElementTagNameMap {
[WEB_COMPONENT_NAME]: WidgetProps;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super simple, now the element type is equivalent to WidgetProps, so the ide will only show widgetProps in the autocomplete:

image

@codingki
Copy link
Member

can add this to the documentation, I'm not sure there is a doc for web component.

Comment on lines 33 to +53

## Usage

Props are the same as [`WidgetProps`](./configuration), but passed as attributes in kebab-case. Use strings or stringified objects for complex props.
Props are the exact same as [`WidgetProps`](./configuration) but you are required to pass them to the element via javascript/typescript.

```tsx
<div style="width:100%; max-width:500px; padding:0 10px;">
<skip-widget
theme='{
"brandColor": "#FF4FFF",
}'
default-route='{
"srcChainId": "osmosis-1",
"srcAssetDenom": "ibc/1480b8fd20ad5fcae81ea87584d269547dd4d436843c1d20f15e00eb64743ef4"
}'
></skip-widget>
<skip-widget></skip-widget>
</div>
<script>
const skipWidget = document.querySelector("skip-widget");
if (skipWidget) {
skipWidget.theme = {
brandColor: "#FF4FFF",
};
skipWidget.defaultRoute = {
srcChainId: "osmosis-1",
srcAssetDenom: "ibc/1480b8fd20ad5fcae81ea87584d269547dd4d436843c1d20f15e00eb64743ef4",
}
}
</script>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can add this to the documentation, I'm not sure there is a doc for web component.

@codingki docs are here and this is where it shows up https://docs.skip.build/go/widget/web-component

@toddkao toddkao merged commit 4df8070 into staging Apr 15, 2025
6 checks passed
@toddkao toddkao deleted the wip-fixing-web-component branch April 15, 2025 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants