-
Notifications
You must be signed in to change notification settings - Fork 0
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
feature: Email Link and Phone Link (in Action Block) #236
base: main
Are you sure you want to change the base?
Conversation
Deploying head-start with Cloudflare Pages
|
field_type: 'string', | ||
api_key: 'phone_number', | ||
hint: 'Best to use international notation: +31 20 2610954', | ||
validators: { required: {} }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could add more validation here, but validating phone numbers can be tricky. Editors can also just try if the number the entered, works in the preview.
Even more nice to have would be a Phone Input Field as a DatoCMS plugin. We could create that based on react-phone-number-input
. Pinging @velomovies ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would even go as far as saying this feature can be implemented just by adding a plugin, right? They're all links..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MarleenEliza mentioned that my assumption was incorrect, mailto:
etc are note valid URLs according to Dato.
export type Props = HTMLAttributes<'a'> & PhoneLinkProps; | ||
const { action, phoneNumber, text, ...props } = Astro.props; | ||
|
||
const formatPhoneNumber = (phoneNumber: string) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit of a naive formatter. Could pull in the very popular libphonenumber-js
package (has zero dependencies) to do the phone number formatting:
Important
Depends on #234, which should be merged first.
Changes
Associated issue
N/A
How to test
email-and-phone-links
environment and play around with the new Email Link and Phone Link option in Action BlocksChecklist
I have made updated relevant documentation files (in project README, docs/, etc)I have added a decision log entry if the change affects the architecture or changes a significant technology