@airtable/blocks/ui#SelectButtonsSynced JavaScript Examples
The following examples show how to use
@airtable/blocks/ui#SelectButtonsSynced.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: settings.js From neighbor-express with MIT License | 5 votes |
function EmailTypeSettings({ emailType }) {
const globalConfig = useGlobalConfig();
const audienceOptions = [
{ value: "volunteer", label: "Volunteer" },
{ value: "recipient", label: "Delivery Recipient" },
];
const deliveriesTable = useBase().getTableByNameIfExists("Deliveries");
const triggerField = deliveriesTable.getFieldIfExists(
globalConfig.get("trigger_column")
);
const stageOptions = triggerField?.options.choices.map((choice) => {
return {
value: choice.id,
label: choice.name,
};
});
function deleteMe() {
globalConfig.setAsync(["email_types", emailType], undefined);
}
return (
<Box padding={3}>
<TextButton onClick={deleteMe} icon="trash" style={{ float: "right" }}>
Delete
</TextButton>
<Accordion title={emailType}>
<InputSetter
label="Sendgrid Template ID"
description="Find this in the Sendgrid UI. Looks like d-ea13bf1f408947829fa19779eade8250"
keyOrPath={["email_types", emailType, "sendgrid_template"]}
/>
<FormField
label="Send to..."
description="Who should this email be sent to?"
>
<SelectButtonsSynced
globalConfigKey={["email_types", emailType, "audience"]}
options={audienceOptions}
width="320px"
/>
</FormField>
<FormField
label="Send when..."
description={`Email will be sent when ${triggerField.name} column is...`}
>
<SelectSynced
globalConfigKey={["email_types", emailType, "stage"]}
options={stageOptions}
width="320px"
/>
</FormField>
</Accordion>
</Box>
);
}