namespace ShoopNCook.Views;

public partial class StoredRecipeView : ContentView
{

    public StoredRecipeView() : this(5, "Title")
    { }

    public StoredRecipeView(float note, string title)
    {
        InitializeComponent();
        Note = note;
        Title = title;
    }

    public float Note
    {
        set => SetNote(value);
    }

    public string Title
    {
        set => TitleLabel.Text = value;
    }



    private void SetNote(float note)
    {
        int i = 1;
        foreach (Image img in Stars.Children)
        {
            if (i <= note)
            {
                img.Opacity = 0;
                i++;
            }
            else img.Opacity = 1;
        }
    }
}