.agents/skills/opik-frontend/responsive-design.md
Phone support is NOT required by default. Only add when:
| Scenario | Use |
|---|---|
| Styling (padding, margins, colors) | Tailwind md: |
| Layout direction | Tailwind md:flex-row |
| Show/hide element | hidden md:block |
| Different component | useIsPhone |
| Different prop values | useIsPhone |
| Structural DOM changes | useIsPhone |
Mobile-first: base classes = phone, md: = tablet+
// Styling changes
<div className="w-full px-4 md:w-[468px] md:px-0">
// Layout direction
<div className="flex flex-col gap-4 md:flex-row md:gap-6">
// Visibility
<div className="hidden md:block">Desktop only</div>
import { useIsPhone } from "@/hooks/useIsPhone";
const { isPhonePortrait } = useIsPhone();
// Different component
if (isPhonePortrait) {
return <BottomSheet>{content}</BottomSheet>;
}
return <SideDialog>{content}</SideDialog>;
// Different props
<DialogContent
side={isPhonePortrait ? "bottom" : "right"}
size={isPhonePortrait ? "full" : "md"}
/>
// Device detection
const { isPhone, isPhonePortrait, isPhoneLandscape } = useIsPhone();
// Custom queries
const isTablet = useMediaQuery("(min-width: 768px) and (max-width: 1023px)");
// Constants
import { QUERY_IS_PHONE_PORTRAIT } from "@/constants/responsiveness";
| Prefix | Min Width |
|---|---|
| (none) | 0px (mobile) |
md: | 768px |
lg: | 1024px |
xl: | 1280px |