Skip to content
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

feat(react-components): modal customization and offer status updates #120

Merged
merged 4 commits into from
Jan 6, 2025

Conversation

samsiegart
Copy link
Contributor

@samsiegart samsiegart commented Jan 6, 2025

closes #119
closes #118

Description

For #118, this adds the modalTheme prop to the AgoricProvider, which seems to successfully allow style overrides when tested with https://github.com/Agoric/ui-kit/tree/main/packages/example.

For #119, it fixes the logic to call onStatusUpdate when the dialog is dismissed without proceeding.

Testing

Tested in https://github.com/Agoric/ui-kit/tree/main/packages/example manually.

Documentation Considerations

The modalTheme prop supports customization via overrides, as well as creating a custom theme, as documented in https://docs.cosmology.zone/cosmos-kit/migration-to-v2#customizing-the-default-modal. For some reason, it only works to pass the modalTheme prop into ChainProvider... the ThemeProvider props don't work. It's not really clear from the documentation what the difference is. Probably something to do with how the css-in-js library that interchain-ui uses works when it's packaged with vite (maybe it expects nextjs and to not be wrapped by another package). Furthermore, the customization doesn't seem to work too well. I wasn't able to get a custom theme working, even when testing in isolation, and the overrides are very limited. For example, you can override the button background color, but can't specify it according to button type, so the "Proceed" and "Go Back" buttons in the provision dialog will end up the same color. Because of this, I wouldn't recommend devs do that unless they implement a custom dialog/provision flow altogether. The option is still available at least. I don't think it looks too bad to use the default styling because it's in a modal, so it's less jarring if it doesn't match the rest of the app.

@samsiegart samsiegart requested a review from turadg January 6, 2025 18:23
@@ -74,7 +74,11 @@ export const AgoricProviderLite = ({
bigint | undefined
>(undefined);
const [postProvisionOffer, setPostProvisionOffer] = useState<
(() => void) | undefined
| {
Copy link
Member

Choose a reason for hiding this comment

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

consider a type alias

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, TY4R

Copy link

cloudflare-workers-and-pages bot commented Jan 6, 2025

Deploying ui-kit with  Cloudflare Pages  Cloudflare Pages

Latest commit: 906ed7d
Status: ✅  Deploy successful!
Preview URL: https://7d0f0c8e.ui-kit-dwm.pages.dev
Branch Preview URL: https://react-fixes.ui-kit-dwm.pages.dev

View logs

@samsiegart samsiegart changed the title react-components fixes feat(react-components): modal customization and offer status updates Jan 6, 2025
@samsiegart samsiegart enabled auto-merge (squash) January 6, 2025 18:40
@samsiegart samsiegart merged commit 6184470 into main Jan 6, 2025
2 checks passed
@samsiegart samsiegart deleted the react-fixes branch January 6, 2025 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants