protected function getAnswerCards(): array
{
$answers = $this->getRecord()->answers;
return $answers->map(function ($answer) {
return Components\Card::make()
->schema([
Components\TextEntry::make('answer_text')
->state($answer->answer_text)
->weight($answer->is_correct ? 'bold' : 'normal')
->color($answer->is_correct ? 'success' : 'gray')
->columnSpan(2),
Components\IconEntry::make('is_correct')
->state($answer->is_correct)
->label('Correct Answer')
->icon(fn (bool $state): string => $state ? 'heroicon-o-check-circle' : 'heroicon-o-x-circle')
->color(fn (bool $state): string => $state ? 'success' : 'danger')
->size(Components\IconEntry\IconEntrySize::Large)
->alignCenter(),
])
->columns(2)
->extraAttributes([
'class' => $answer->is_correct ? 'border-2 border-indigo-500' : 'border-gray-300',
'style' => 'min-height: 120px; display: flex; flex-direction: column; justify-content: space-between;',
]);
})->toArray();
}
protected function getAnswerCards(): array
{
$answers = $this->getRecord()->answers;
return $answers->map(function ($answer) {
return Components\Card::make()
->schema([
Components\TextEntry::make('answer_text')
->state($answer->answer_text)
->weight($answer->is_correct ? 'bold' : 'normal')
->color($answer->is_correct ? 'success' : 'gray')
->columnSpan(2),
Components\IconEntry::make('is_correct')
->state($answer->is_correct)
->label('Correct Answer')
->icon(fn (bool $state): string => $state ? 'heroicon-o-check-circle' : 'heroicon-o-x-circle')
->color(fn (bool $state): string => $state ? 'success' : 'danger')
->size(Components\IconEntry\IconEntrySize::Large)
->alignCenter(),
])
->columns(2)
->extraAttributes([
'class' => $answer->is_correct ? 'border-2 border-indigo-500' : 'border-gray-300',
'style' => 'min-height: 120px; display: flex; flex-direction: column; justify-content: space-between;',
]);
})->toArray();
}