Miao-Yunzai/views/hello.tsx

39 lines
923 B
TypeScript
Raw Normal View History

2024-06-16 00:21:18 +08:00
import React from 'react'
import Nav from '../component/Nav.tsx'
import NavItem from '../component/NavItem.tsx'
import List from '../component/List.tsx'
import ListItem, { MovieType } from '../component/ListItem.tsx'
2024-06-16 18:11:37 +08:00
import { createRequire } from 'module'
2024-06-16 00:21:18 +08:00
export type DataType = {
name: string
}
2024-06-16 18:11:37 +08:00
2024-06-16 00:21:18 +08:00
export type PropsType = {
data: DataType
2024-06-16 18:11:37 +08:00
movies: MovieType[]
2024-06-16 00:21:18 +08:00
}
2024-06-16 18:11:37 +08:00
2024-06-16 00:21:18 +08:00
const require = createRequire(import.meta.url)
2024-06-16 18:11:37 +08:00
const url: string = require('../resources/example.png')
/**
*
* @param param0
* @returns
*/
2024-06-16 00:21:18 +08:00
export default function App({ data, movies }: PropsType) {
return (
<div className="divide-y divide-slate-100 m-8 shadow-2xl">
<img className='h-40 w-40' src={url}></img>
2024-06-16 18:11:37 +08:00
<Nav>
<NavItem href="./music" >New {data.name}</NavItem>
</Nav>
<List>
{movies.map((movie) => (
<ListItem key={movie.id} movie={movie} />
))}
</List>
</div>
2024-06-16 00:21:18 +08:00
)
}