'use client'; import React from 'react'; import { ResponsiveSheet, ResponsiveSheetContent, ResponsiveSheetHeader, ResponsiveSheetTitle, } from '@djangocfg/ui-core/components'; import { usePlaygroundContext } from '../../context/PlaygroundContext'; import { RequestPanel } from '../shared/RequestPanel'; import { ResponsePanel } from '../shared/ResponsePanel'; import { SendButton } from '../shared/SendButton'; interface TryItSheetProps { open: boolean; onOpenChange: (open: boolean) => void; } /** * Mobile/tablet fallback: the slide-in playground doesn't fit, so we * open Request + Response inside a ResponsiveSheet (bottom drawer on * mobile, side sheet on desktop). Response stays hidden until a * request has been sent — matching the desktop ``SlideInPlayground`` * behaviour. */ export function TryItSheet({ open, onOpenChange }: TryItSheetProps) { const { state } = usePlaygroundContext(); const showResponse = state.response !== null || state.loading; return ( Playground {/* Send button sits inside the Request section so it reads as an action on the form, not an ambiguous page-level footer when Response is also visible. */}
{state.selectedEndpoint && (
)}
{showResponse && (
)}
); }