@if (_isSelected)
{
    <MudCard @onclick="SelectChanged" class="text-center bg-[--color-medicalhistory]">
        <MudCardContent>
            <p class="font-extrabold text-gray-600 text-md">@Question</p>
        </MudCardContent>
    </MudCard>
}
else
{
    <MudCard @onclick="SelectChanged" class="text-center">
        <MudCardContent>
            <p class="font-extrabold text-gray-600 text-md">@Question</p>
        </MudCardContent>
    </MudCard>
}

@code 
{
    protected override void OnParametersSet()
    {
        base.OnParametersSet();
        if (!Answer.IsNullOrEmpty())
        {
            _isSelected = Answer == Question;
        }
    }

    [Parameter]
    public string Answer { get; set; } = string.Empty;

    [Parameter]
    public EventCallback<string> AnswerChanged { get; set; }

    [Parameter]
    public string Question { get; set; } = string.Empty;

    private bool _isSelected = false;

    private async Task SelectChanged()
    {
        _isSelected = !_isSelected;

        Answer = _isSelected ? Question : string.Empty;

        await AnswerChanged.InvokeAsync(Answer);
    }
}
