Add Example to Crm Data Components to Demonstrate CrmCardActions & CrmActionButton#75
Add Example to Crm Data Components to Demonstrate CrmCardActions & CrmActionButton#75
CrmCardActions & CrmActionButton#75Conversation
|
@aanchalHS you were listed as a suggested reviewer for this PR, but please feel free to tag someone else if this recommendation was incorrect! |
deidrakandra
left a comment
There was a problem hiding this comment.
Looks good to me.
Would it be worth showing how to use the onError callback for at least one of the actions? There isn't an explicit example of that in the docs.
| hubspot.extend(({ context, runServerlessFunction, actions }) => ( | ||
| <Extension | ||
| context={context} | ||
| runServerless={runServerlessFunction} | ||
| sendAlert={actions.addAlert} | ||
| /> | ||
| )); |
There was a problem hiding this comment.
Probably don't need these if they aren't being used in your extension?
| hubspot.extend(({ context, runServerlessFunction, actions }) => ( | |
| <Extension | |
| context={context} | |
| runServerless={runServerlessFunction} | |
| sendAlert={actions.addAlert} | |
| /> | |
| )); | |
| hubspot.extend(({ context }) => ( | |
| <Extension | |
| context={context} | |
| /> | |
| )); |
There was a problem hiding this comment.
It looks like all three props are required for Extension per its type. Even though they're not used, we may still want to leave them to prevent TS errors
| ]; | ||
|
|
||
| const Extension = ({ context, runServerless, sendAlert }) => { | ||
| const [scenario, setScenario] = useState<any>("engagement"); |
There was a problem hiding this comment.
Should this be a string if using ts?
| const [scenario, setScenario] = useState<any>("engagement"); | |
| const [scenario, setScenario] = useState<string>("engagement"); |
| const currentObjectId = context.crm.objectId; | ||
| const currentObjectTypeId = context.crm.objectTypeId; | ||
|
|
||
| const actionsToPropertiesMap = { |
There was a problem hiding this comment.
Might be worth wrapping this in a useMemo?
| </Text> | ||
|
|
||
| <Flex direction="row" align="end" gap="small"> | ||
| <Form> |
There was a problem hiding this comment.
Do you need a Form here?
- Add example of onError for CrmActionsButton - PR Feedback
Summary
This PR creates a new example for the
CrmCardActionsandCrmActionButtoncomponents withincrm-data-components. This new example is aCrmPropertyListthat dynamically changes the properties displayed and actions button based on a given scenario from a dropdown select. Updates theREADMEwith images and documentation as well.