@airtable/blocks/ui#Label JavaScript Examples
The following examples show how to use
@airtable/blocks/ui#Label.
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 | 4 votes |
export function SettingsComponent({ exit }) {
const globalConfig = useGlobalConfig();
if (globalConfig.get("template_variables") === undefined) {
globalConfig.setAsync("template_variables", {});
}
if (globalConfig.get("email_types") === undefined) {
globalConfig.setAsync("email_types", {});
}
return (
<Box padding={3}>
<Button variant="primary" onClick={exit} style={{ float: "right" }}>
Exit settings
</Button>
<h1> Settings </h1>
<p>
{" "}
You probably won't need to do anything here unless you're just starting
out.{" "}
</p>
<Accordion title="Global">
<InputSetter
label="Organization name"
description="When people reply to your emails, what is the name they will see?"
keyOrPath={["reply_to", "name"]}
/>
<InputSetter
label="Reply email"
description="What email address should people use to reply to your emails?"
keyOrPath={["reply_to", "email"]}
/>
<InputSetter
label="Sendgrid proxy token"
description="This is a secret token that is used to authenticate sending the email"
keyOrPath="SENDGRID_PROXY_TOKEN"
/>
<FieldSetter
label="Trigger column"
description="Which column should be used to determine whether an email is sent?"
keyOrPath="trigger_column"
tableName="Deliveries"
allowedTypes={[FieldType.SINGLE_SELECT]}
/>
</Accordion>
<Accordion title="Email Types">
<h4>Delivery Emails</h4>
<Text>
Here you can configure emails to go out at various stages of a
delivery. Emails can be set up for both the delivery recipient and the
volunteer.
</Text>
{Object.keys(globalConfig.get("email_types")).map((emailType) => {
return <EmailTypeSettings key={emailType} emailType={emailType} />;
})}
<AddEmailTypeDialog />
<Box>
<h4>Volunteer Emails</h4>
<Text>
Enable the setting below if you want to send volunteers a welcome
email when they first sign up.
</Text>
<Switch
value={!!globalConfig.get("enable_volunteer_welcome_email")}
onChange={(newValue) =>
globalConfig.setAsync("enable_volunteer_welcome_email", newValue)
}
label="Email volunteers on inital signup"
width="320px"
/>
{globalConfig.get("enable_volunteer_welcome_email") ? (
<>
<Label htmlFor="volunteer-welcome-template-id-input">
Volunteer welcome email sendgrid template ID
</Label>
<Input
id="volunteer-welcome-template-id-input"
value={
globalConfig.get("volunteer_welcome_email_template_id") || ""
}
onChange={(e) =>
globalConfig.setAsync(
"volunteer_welcome_email_template_id",
e.target.value
)
}
placeholder="Enter Sendgrid Template ID here"
/>
<FieldSetter
label="Volunteer name field"
description="The field containing volunteers names"
keyOrPath="volunteer_name_field"
tableName="Volunteers"
/>
</>
) : null}
</Box>
</Accordion>
<Accordion title="Template Variables">
{["Deliveries", "Volunteers"].map((tableName) => {
return (
<TableTemplateVariables key={tableName} tableName={tableName} />
);
})}
</Accordion>
</Box>
);
}