-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MRKT-27: Single Item for play - Initial Item Page (#577)
* feat: Create initial single Item page with card * feat: Move Single Item page for dynamic route * feat: Implement with static test data
- Loading branch information
Showing
7 changed files
with
161 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { FunctionComponent, ReactNode } from "react"; | ||
import { mockSongs } from "../../../temp/data"; | ||
|
||
interface SongLayoutProps { | ||
readonly children: ReactNode; | ||
} | ||
|
||
export const generateStaticParams = async () => { | ||
return mockSongs.map(({ id }) => ({ songId: id })); | ||
}; | ||
|
||
const Layout: FunctionComponent<SongLayoutProps> = ({ children }) => { | ||
return children; | ||
}; | ||
|
||
export default Layout; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
"use client"; | ||
import { Container, Stack } from "@mui/material"; | ||
import { SongCard } from "@newm-web/components"; | ||
import { FunctionComponent, useEffect, useState } from "react"; | ||
import { mockSongs } from "../../../temp/data"; | ||
import { ItemSkeleton } from "../../../components"; | ||
|
||
interface SingleSongProps { | ||
readonly params: { | ||
readonly songId: string; | ||
}; | ||
} | ||
|
||
const SingleSong: FunctionComponent<SingleSongProps> = ({ params }) => { | ||
// TEMP: simulate data loading | ||
const [isLoading, setIsLoading] = useState(true); | ||
|
||
// TEMP: simulate data loading | ||
useEffect(() => { | ||
setTimeout(() => { | ||
setIsLoading(false); | ||
}, 1000); | ||
}, []); | ||
|
||
if (isLoading) { | ||
return <ItemSkeleton />; | ||
} | ||
|
||
return ( | ||
<Container sx={ { flexGrow: 1, mt: 5 } }> | ||
<Stack alignItems="center" mt={ 2.5 }> | ||
<SongCard | ||
coverArtUrl={ | ||
mockSongs.find((song) => song.id === params.songId)?.coverArtUrl | ||
} | ||
isPlayable={ true } | ||
price="3.0" | ||
size="Large" | ||
// eslint-disable-next-line @typescript-eslint/no-empty-function | ||
onPriceClick={ () => {} } | ||
// eslint-disable-next-line @typescript-eslint/no-empty-function | ||
onSubtitleClick={ () => {} } | ||
// eslint-disable-next-line @typescript-eslint/no-empty-function | ||
onTitleClick={ () => {} } | ||
/> | ||
</Stack> | ||
</Container> | ||
); | ||
}; | ||
|
||
export default SingleSong; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
apps/marketplace/src/components/skeletons/ItemSkeleton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Container, Skeleton, Stack } from "@mui/material"; | ||
import { FunctionComponent } from "react"; | ||
|
||
const ItemSkeleton: FunctionComponent = () => ( | ||
<Container sx={ { flexGrow: 1, mt: 5 } }> | ||
<Stack alignItems="center" mt={ 2.5 }> | ||
<Skeleton | ||
sx={ { height: [150, 150, 400], width: [150, 150, 400] } } | ||
variant="rectangular" | ||
/> | ||
</Stack> | ||
</Container> | ||
); | ||
|
||
export default ItemSkeleton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { default as ArtistSkeleton } from "./ArtistSkeleton"; | ||
export { default as ItemSkeleton } from "./ItemSkeleton"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters