When this project was started, one of the goals was to add validations for phone numbers using the data in countries.rs. Currently, only the phone code, country emoji and country name are used. However, the file also includes:
- Phone number length (3rd field):
- Continent:
- Sub-region of the continent
What you can do:
- Add validation for phone number length, somewhere in this callback function:
|
let on_phone_number_input = { |
|
let r#ref = props.r#ref.clone(); |
|
let handle = props.handle.clone(); |
|
let country_handle = country_handle; |
|
Callback::from(move |_| { |
|
if let Some(input) = r#ref.cast::<HtmlInputElement>() { |
|
for (code, _, _, _, _, _) in &COUNTRY_CODES { |
|
if code.starts_with(&input.value()) { |
|
country_handle.set(input.value()); |
|
break; |
|
} |
|
} |
|
// Filter out non-numeric characters |
|
let numeric_value: String = |
|
input.value().chars().filter(|c| c.is_numeric()).collect(); |
|
handle.set('+'.to_string() + &numeric_value); |
|
} |
|
}) |
|
}; |
- Enable searching/filtering by continent or region.
- Use any framework you're comfortable with, or all, if you're up for the challenge!
This is marked as a good first issue, feel free to take a stab at it!
Good luck!
When this project was started, one of the goals was to add validations for phone numbers using the data in
countries.rs. Currently, only the phone code, country emoji and country name are used. However, the file also includes:input-rs/src/countries.rs
Line 6 in 3d37fdb
input-rs/src/countries.rs
Line 8 in 3d37fdb
input-rs/src/countries.rs
Line 9 in 3d37fdb
What you can do:
input-rs/src/yew.rs
Lines 379 to 397 in 3d37fdb
This is marked as a good first issue, feel free to take a stab at it!
Good luck!