-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Support for onClick and target properties in <Page> actions for EmbeddedApp #46
Comments
Hi @jimmyn. The <Page secondaryActions={[{content: 'About', onAction: () => history.push('/about')}]}> and it should work fine. The first one does not work currently, but it's one of the things we are actively working on. That should be part of our first minor release. I'll close this issue once we've actually shipped the feature. |
@lemonmade thanks for the explanation, great job with polaris! |
Hi, can i add onClick to ResourceList.Item ? I want to open a modal instead of going to a specific page. |
@Korfos see my code:
If you want use url prop, call a function with: If you want use actions, call same function with: |
@hallenmaia I tried adding my own function like bellow, but it doesn't seem to trigger. Am i doing something wrong? <ResourceList items={this.props.data.map((campaign, index) => ( { url: this.my_function(index), attributeOne: campaign.name, actions: [ {content: "Delete", onClick: () => this.handleDestroy(campaign.id)} ], persistActions: true, exceptions: [], } ))} renderItem={(item, index) => { return <ResourceList.Item key={index} {...item} />; }} /> |
I used onAction in the actions section and it worked like this. Thanks for the pointers. |
@Korfos the url prop only accepts string (URL). I'm sorry for incorrect aswer. See complete test code: https://codesandbox.io/s/zp8J4AAx7 |
Yeah, if it's an action on the item, we recommend using |
@lemonmade very nice code. Living and learning. |
Should be fixed by v1.1.0 (we now automatically infer the |
It would be great if
<Page>
component can support all the attributes that ShopifyApp.Bar.initialize supports in the embedded app SDK.Something like:
<Page secondaryActions={[{content: 'About', url: '/about', target: 'app'}]}>
Or
<Page secondaryActions={[{content: 'About', onClick: () => history.push('/about')}]}>
The text was updated successfully, but these errors were encountered: