Skip to content
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

Checkbox widget implementation #23

Closed
presiyan-ivanov opened this issue May 4, 2023 · 0 comments · Fixed by #30
Closed

Checkbox widget implementation #23

presiyan-ivanov opened this issue May 4, 2023 · 0 comments · Fixed by #30
Labels
good first issue Good for newcomers

Comments

@presiyan-ivanov
Copy link
Collaborator

presiyan-ivanov commented May 4, 2023

Implementation suggestions:
The API should look something like this:

fn app_view(cx: AppContext) -> impl View {
    let (is_checked, set_is_checked) = create_signal(cx.scope, false);
    click(
        cx,
        |cx| {
            stack(cx, |cx| {
                (
                    check_box(cx, move || is_checked.get()),
                    label(cx, || "Is checked?".to_string()),
                )
            })
        },
        move || set_is_checked.update(|checked| *checked = !*checked),
    )
}

The disabled fn in decorator.rs can be used as a reference to implement the checked fn of check_box.
The check_box should simply render a container with a border that has an svg for the check mark.

Bonus points if the checkbox is added to the widget-gallery example :)

@presiyan-ivanov presiyan-ivanov added the good first issue Good for newcomers label May 4, 2023
@0HyperCube 0HyperCube mentioned this issue May 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant