Skip to content

Add support for phone number validations and continent-based search #18

@wiseaidev

Description

@wiseaidev

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:

What you can do:

  • Add validation for phone number length, somewhere in this callback function:

    input-rs/src/yew.rs

    Lines 379 to 397 in 3d37fdb

    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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions