mirror of
https://github.com/zimplexing/OrionTV.git
synced 2026-05-18 23:07:31 +08:00
feat: Enhance mobile and tablet support with responsive layout adjustments and new navigation components
This commit is contained in:
50
components/VideoCard.tsx
Normal file
50
components/VideoCard.tsx
Normal file
@@ -0,0 +1,50 @@
|
||||
import React from 'react';
|
||||
import { TouchableOpacity } from 'react-native';
|
||||
import { useResponsiveLayout } from '@/hooks/useResponsiveLayout';
|
||||
import { API } from '@/services/api';
|
||||
|
||||
// 导入不同平台的VideoCard组件
|
||||
import VideoCardMobile from './VideoCard.mobile';
|
||||
import VideoCardTablet from './VideoCard.tablet';
|
||||
import VideoCardTV from './VideoCard.tv';
|
||||
|
||||
interface VideoCardProps extends React.ComponentProps<typeof TouchableOpacity> {
|
||||
id: string;
|
||||
source: string;
|
||||
title: string;
|
||||
poster: string;
|
||||
year?: string;
|
||||
rate?: string;
|
||||
sourceName?: string;
|
||||
progress?: number;
|
||||
playTime?: number;
|
||||
episodeIndex?: number;
|
||||
totalEpisodes?: number;
|
||||
onFocus?: () => void;
|
||||
onRecordDeleted?: () => void;
|
||||
api: API;
|
||||
}
|
||||
|
||||
/**
|
||||
* 响应式VideoCard组件
|
||||
* 根据设备类型自动选择合适的VideoCard实现
|
||||
*/
|
||||
const VideoCard = React.forwardRef<any, VideoCardProps>((props, ref) => {
|
||||
const { deviceType } = useResponsiveLayout();
|
||||
|
||||
switch (deviceType) {
|
||||
case 'mobile':
|
||||
return <VideoCardMobile {...props} ref={ref} />;
|
||||
|
||||
case 'tablet':
|
||||
return <VideoCardTablet {...props} ref={ref} />;
|
||||
|
||||
case 'tv':
|
||||
default:
|
||||
return <VideoCardTV {...props} ref={ref} />;
|
||||
}
|
||||
});
|
||||
|
||||
VideoCard.displayName = 'VideoCard';
|
||||
|
||||
export default VideoCard;
|
||||
Reference in New Issue
Block a user