mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-15 22:19:40 +02:00
- Move finance, mail, moodlit to apps-archived for later development - Rename games/voxel-lava to games/voxelava 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
import { useWindowDimensions } from 'react-native';
|
|
|
|
export type ScreenSize = 'small' | 'medium' | 'large' | 'xlarge';
|
|
|
|
export const useResponsive = () => {
|
|
const { width, height } = useWindowDimensions();
|
|
|
|
// Breakpoints
|
|
const isSmall = width < 768; // Phone
|
|
const isMedium = width >= 768 && width < 1024; // Tablet Portrait
|
|
const isLarge = width >= 1024 && width < 1440; // Tablet Landscape / Small Desktop
|
|
const isXLarge = width >= 1440; // Large Desktop / Mac
|
|
|
|
const screenSize: ScreenSize = isSmall
|
|
? 'small'
|
|
: isMedium
|
|
? 'medium'
|
|
: isLarge
|
|
? 'large'
|
|
: 'xlarge';
|
|
|
|
// Responsive values
|
|
const maxContentWidth = isSmall ? width : isMedium ? 720 : isLarge ? 960 : 1200;
|
|
const numColumns = isSmall ? 1 : isMedium ? 2 : isLarge ? 2 : 3;
|
|
const horizontalPadding = isSmall ? 16 : isMedium ? 32 : 48;
|
|
const cardAspectRatio = isSmall ? 16 / 9 : 2 / 1;
|
|
|
|
return {
|
|
width,
|
|
height,
|
|
isSmall,
|
|
isMedium,
|
|
isLarge,
|
|
isXLarge,
|
|
isTablet: isMedium || isLarge,
|
|
isDesktop: isLarge || isXLarge,
|
|
screenSize,
|
|
maxContentWidth,
|
|
numColumns,
|
|
horizontalPadding,
|
|
cardAspectRatio,
|
|
};
|
|
};
|