Add Zeckendorf Search Magic Trick with improved layout and card numbering
This commit is contained in:
parent
a7a026f87c
commit
e37f3ed884
1 changed files with 24 additions and 27 deletions
|
|
@ -12,7 +12,7 @@ interface ZeckendorfSearchTrickProps {
|
|||
}
|
||||
|
||||
// First 8 Fibonacci numbers: 1, 1, 2, 3, 5, 8, 13, 21
|
||||
const FIBONACCI_NUMBERS = [21, 13, 8, 5, 3, 2, 1, 1];
|
||||
const FIBONACCI_NUMBERS = [21, 13, 8, 5, 3, 2, 1];
|
||||
|
||||
// Function to get Zeckendorf representation of a number
|
||||
const getZeckendorfRepresentation = (n: number): number[] => {
|
||||
|
|
@ -308,30 +308,14 @@ const ZeckendorfSearchTrick = ({ showSocialShare = true }: ZeckendorfSearchTrick
|
|||
{getDisplayCards().map(card => (
|
||||
<Card key={card.id} className="relative">
|
||||
<CardHeader className="pb-2">
|
||||
<CardTitle className="text-xl text-center">{card.title}</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="pt-0 flex flex-col h-full">
|
||||
<div className="grid grid-cols-4 gap-1 text-xs">
|
||||
{card.numbers.map(num => (
|
||||
<div
|
||||
key={num}
|
||||
className={`p-1 text-center rounded ${
|
||||
isSpoiler && num === card.id
|
||||
? 'bg-yellow-200 font-bold'
|
||||
: 'bg-muted'
|
||||
}`}
|
||||
>
|
||||
{num}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="flex gap-2 mt-4 mt-auto">
|
||||
<div className="flex justify-between items-start">
|
||||
<CardTitle className="text-xl">{isSpoiler ? card.id : card.title.replace('Card ', '')}</CardTitle>
|
||||
<div className="flex gap-2">
|
||||
<Button
|
||||
onClick={() => handleCardSelection(card.id, 'present')}
|
||||
variant={cardStates[card.id] === 'present' ? 'default' : 'outline'}
|
||||
size="sm"
|
||||
className="flex-1 aspect-square flex items-center justify-center"
|
||||
className="aspect-square flex items-center justify-center"
|
||||
>
|
||||
✅
|
||||
</Button>
|
||||
|
|
@ -339,11 +323,24 @@ const ZeckendorfSearchTrick = ({ showSocialShare = true }: ZeckendorfSearchTrick
|
|||
onClick={() => handleCardSelection(card.id, 'absent')}
|
||||
variant={cardStates[card.id] === 'absent' ? 'default' : 'outline'}
|
||||
size="sm"
|
||||
className="flex-1 aspect-square flex items-center justify-center"
|
||||
className="aspect-square flex items-center justify-center"
|
||||
>
|
||||
❌
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent className="pt-0">
|
||||
<div className="grid grid-cols-4 gap-1 text-xs">
|
||||
{card.numbers.map(num => (
|
||||
<div
|
||||
key={num}
|
||||
className="p-1 text-center rounded h-6 flex items-center justify-center bg-muted"
|
||||
>
|
||||
{num}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
))}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue