Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions components/teacher/block-editor/add-block-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ interface AddBlockMenuProps {
position?: 'top' | 'inline' | 'between'
}

// The palette is taller than the room most triggers leave on screen; PopoverContent
// caps itself at `--available-height` and scrolls, so all 23 blocks stay reachable.
const PALETTE_POPOVER_CLASS = 'w-[360px] p-3'

export function AddBlockMenu({ onSelect, position = 'inline' }: AddBlockMenuProps) {
const [open, setOpen] = useState(false)

Expand All @@ -111,7 +115,7 @@ export function AddBlockMenu({ onSelect, position = 'inline' }: AddBlockMenuProp
<IconPlus className="h-3 w-3" />
</PopoverTrigger>
</div>
<PopoverContent align="center" side="bottom" className="w-[340px] p-3" sideOffset={4}>
<PopoverContent align="center" side="bottom" className={PALETTE_POPOVER_CLASS} sideOffset={4}>
<BlockPalette onSelect={handleSelect} />
</PopoverContent>
</Popover>
Expand All @@ -128,7 +132,7 @@ export function AddBlockMenu({ onSelect, position = 'inline' }: AddBlockMenuProp
<IconPlus className="h-4 w-4" />
Añadir bloque
</PopoverTrigger>
<PopoverContent align="center" side="bottom" className="w-[340px] p-3" sideOffset={4}>
<PopoverContent align="center" side="bottom" className={PALETTE_POPOVER_CLASS} sideOffset={4}>
<BlockPalette onSelect={handleSelect} />
</PopoverContent>
</Popover>
Expand All @@ -144,7 +148,7 @@ export function AddBlockMenu({ onSelect, position = 'inline' }: AddBlockMenuProp
>
<IconPlus className="h-4 w-4" />
</PopoverTrigger>
<PopoverContent align="end" side="bottom" className="w-[340px] p-3" sideOffset={4}>
<PopoverContent align="end" side="bottom" className={PALETTE_POPOVER_CLASS} sideOffset={4}>
<BlockPalette onSelect={handleSelect} />
</PopoverContent>
</Popover>
Expand All @@ -159,7 +163,7 @@ function BlockPalette({ onSelect }: { onSelect: (type: BlockType) => void }) {
<div className="space-y-3">
{BLOCK_GROUPS.map((group) => (
<div key={group.label}>
<p className="mb-1.5 px-1 text-[10px] font-semibold uppercase tracking-widest text-muted-foreground/60">
<p className="mb-1.5 px-1 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground">
{group.label}
</p>
<div className="grid grid-cols-3 gap-1.5">
Expand All @@ -181,7 +185,7 @@ function BlockPalette({ onSelect }: { onSelect: (type: BlockType) => void }) {
<div className={cn('flex h-8 w-8 items-center justify-center rounded-md', iconData.bg)}>
<Icon className={cn('h-4 w-4', iconData.color)} />
</div>
<span className="text-[11px] font-medium leading-tight text-muted-foreground group-hover:text-foreground">
<span className="text-xs font-medium leading-tight text-foreground/80 group-hover:text-foreground">
{meta?.label || type}
</span>
</button>
Expand Down
2 changes: 1 addition & 1 deletion components/ui/popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function PopoverContent({
<PopoverPrimitive.Popup
data-slot="popover-content"
className={cn(
"z-50 flex w-72 origin-(--transform-origin) flex-col gap-4 rounded-lg bg-popover p-2.5 text-xs text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
"z-50 flex max-h-(--available-height) w-72 origin-(--transform-origin) flex-col gap-4 overflow-y-auto overscroll-contain rounded-lg bg-popover p-2.5 text-xs text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
className
)}
{...props}
Expand Down
Loading