teqo/src/components/campaign/dashboard/CampaignHomeLayout.tsx
Cursor Agent afa05fd5fc
B99 — strip de ações edge-to-edge no mobile + gap menor
- Bleed do slot home-actions com -mx-4 (compensa p-4 do scroll) só no mobile
- Gap horizontal da strip: gap-3 → gap-2
- Unit pin das classes de bleed em campaignHomeLayout

Co-authored-by: Francisco Solla <fsolla@users.noreply.github.com>
2026-08-01 10:54:39 +00:00

84 lines
2.3 KiB
TypeScript

import type { ReactNode } from 'react'
import { cn } from '@/lib/utils'
const homeChromeRetractionClass = (retracted: boolean) =>
cn(
'grid min-h-0 transition-[grid-template-rows,opacity] duration-[220ms] ease-out motion-reduce:transition-none',
retracted
? 'grid-rows-[0fr] opacity-0 pointer-events-none motion-reduce:opacity-0'
: 'grid-rows-[1fr] opacity-100 motion-reduce:opacity-100',
)
const HomeChromeRetractionShell = ({
retracted,
slot,
className,
children,
}: {
retracted: boolean
slot?: string
className?: string
children: ReactNode
}) => (
<div
data-slot={slot}
data-retracted={retracted || undefined}
className={cn(homeChromeRetractionClass(retracted), className)}
aria-hidden={retracted || undefined}
>
<div className="min-h-0 overflow-hidden">{children}</div>
</div>
)
export const CampaignHomeLayout = ({
actions,
searchSlot,
summarySlot,
focused = false,
}: {
actions: ReactNode
searchSlot?: ReactNode
summarySlot?: ReactNode
/** When true (input focused or query active), retract thumb-zone spacer and action strip. */
focused?: boolean
}) => (
<div className="flex h-full min-h-0 w-full flex-col">
<HomeChromeRetractionShell
retracted={focused}
slot="home-chrome"
className={!focused ? 'min-h-0 flex-1 md:flex-none' : undefined}
>
<div className="flex h-full min-h-0 flex-col">
{summarySlot ? (
<div className="min-w-0" data-slot="home-summary">
{summarySlot}
</div>
) : null}
<div aria-hidden className="min-h-0 flex-1 md:hidden" data-slot="home-thumb-spacer" />
</div>
</HomeChromeRetractionShell>
<div data-slot="home-dock" className="flex min-w-0 flex-col">
<HomeChromeRetractionShell
retracted={focused}
slot="home-actions-chrome"
className="order-1 md:order-2"
>
<div
data-slot="home-actions"
className="min-w-0 -mx-4 w-[calc(100%+2rem)] md:mx-0 md:w-auto"
>
{actions}
</div>
</HomeChromeRetractionShell>
{searchSlot ? (
<div
data-slot="home-search"
className={cn('order-2 min-w-0 md:order-1', focused ? 'mt-0' : 'mt-4 md:mt-0 md:mb-6')}
>
{searchSlot}
</div>
) : null}
</div>
</div>
)