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')
|
|
|
|
|
|
|
|
/**
|
2024-06-17 22:52:15 +08:00
|
|
|
*
|
|
|
|
* @param param0
|
|
|
|
* @returns
|
2024-06-16 18:11:37 +08:00
|
|
|
*/
|
2024-06-16 00:21:18 +08:00
|
|
|
export default function App({ data, movies }: PropsType) {
|
|
|
|
return (
|
2024-06-17 22:52:15 +08:00
|
|
|
<section className="flex flex-col">
|
|
|
|
<div className="divide-y divide-slate-100 m-8 shadow-2xl">
|
|
|
|
<img className="h-40 w-40" src={url}></img>
|
|
|
|
<Nav>
|
|
|
|
<NavItem href="./music">New {data.name}</NavItem>
|
|
|
|
</Nav>
|
|
|
|
<List>
|
|
|
|
{movies.map(movie => (
|
|
|
|
<ListItem key={movie.id} movie={movie} />
|
|
|
|
))}
|
|
|
|
</List>
|
|
|
|
</div>
|
|
|
|
</section>
|
2024-06-16 00:21:18 +08:00
|
|
|
)
|
2024-06-17 22:52:15 +08:00
|
|
|
}
|