-
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.
* implements artist spotlight on home page * removes components/index.ts file * removes getResizedAlbumCoverImageUrl for resizeCloudinaryImage * renames Artists component * makes resizeCloudinaryImage url param optional * removes unused type definition * updates comment * improves resizeCloudinaryImage regex * updates artist spotlight click functionality * imports components from top level of components directory * updates artist skeleton spacing * makes artist spotlight image size responsive * minor update to artist spotlight styling * resolves merge conflicts
- Loading branch information
Showing
18 changed files
with
267 additions
and
49 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
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
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,69 @@ | ||
import { Box, Stack, Typography, useTheme } from "@mui/material"; | ||
import { resizeCloudinaryImage } from "@newm-web/utils"; | ||
import { FunctionComponent } from "react"; | ||
import { Clickable } from "@newm-web/elements"; | ||
import ArtistSkeleton from "./skeletons/ArtistSkeleton"; | ||
|
||
interface ArtistProps { | ||
readonly imageUrl: string; | ||
readonly isLoading: boolean; | ||
readonly onSelectArtist: (param: string) => void; | ||
readonly orientation: "row" | "column"; | ||
readonly subtitle: string; | ||
readonly title: string; | ||
} | ||
|
||
/** | ||
* Image and information for an artist. Can be vertically | ||
* or horizontally aligned. | ||
*/ | ||
const Artist: FunctionComponent<ArtistProps> = ({ | ||
imageUrl, | ||
title, | ||
isLoading, | ||
subtitle, | ||
orientation, | ||
onSelectArtist, | ||
}) => { | ||
const theme = useTheme(); | ||
|
||
if (isLoading) { | ||
return <ArtistSkeleton orientation={ orientation } />; | ||
} | ||
|
||
return ( | ||
<Clickable | ||
aria-label={ `${title}-artist-profile` } | ||
onClick={ () => onSelectArtist(title) } | ||
> | ||
<Stack columnGap={ 3.5 } direction={ orientation } rowGap={ 2 }> | ||
<Box | ||
alt={ `${title}-artist-profile` } | ||
component="img" | ||
height={ [150, 150, 200] } | ||
src={ resizeCloudinaryImage(imageUrl, { | ||
height: 200, | ||
width: 200, | ||
}) } | ||
style={ { borderRadius: "50%", maxWidth: "100%" } } | ||
width={ [150, 150, 200] } | ||
/> | ||
<Stack | ||
justifyContent="center" | ||
spacing={ 0.25 } | ||
textAlign={ orientation === "row" ? "start" : "center" } | ||
> | ||
<Typography variant="h4">{ title }</Typography> | ||
<Typography | ||
sx={ { color: theme.colors.grey100, fontWeight: 400 } } | ||
variant="h4" | ||
> | ||
{ subtitle } | ||
</Typography> | ||
</Stack> | ||
</Stack> | ||
</Clickable> | ||
); | ||
}; | ||
|
||
export default Artist; |
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,100 @@ | ||
import { FunctionComponent, useEffect, useState } from "react"; | ||
import { Grid, Stack, Typography } from "@mui/material"; | ||
import Artist from "./Artist"; | ||
|
||
const ArtistSpotlight: FunctionComponent = () => { | ||
// TEMP: simulate data loading | ||
const [isLoading, setIsLoading] = useState(true); | ||
|
||
const handleSelectArtist = (name: string) => { | ||
// placeholder | ||
console.log("artist selected: ", name); // eslint-disable-line | ||
}; | ||
|
||
// TEMP: simulate data loading | ||
useEffect(() => { | ||
setTimeout(() => { | ||
setIsLoading(false); | ||
}, 1000); | ||
}, []); | ||
|
||
return ( | ||
<Stack mb={ 8 }> | ||
<Stack alignItems="center" mb={ 5 } mt={ 20 }> | ||
<Typography fontSize={ ["24px", "24px", "32px"] } variant="h3"> | ||
ARTIST SPOTLIGHT | ||
</Typography> | ||
</Stack> | ||
|
||
<Grid columnGap={ [5, 5, 15] } justifyContent="center" rowGap={ 5 } container> | ||
{ tempArtistData.map(({ imageUrl, name, songCount }, idx) => { | ||
return ( | ||
<Grid display="flex" key={ imageUrl } sx={ { cursor: "pointer" } }> | ||
<Artist | ||
imageUrl={ imageUrl } | ||
isLoading={ isLoading } | ||
orientation="column" | ||
subtitle={ `${songCount} songs` } | ||
title={ name } | ||
onSelectArtist={ handleSelectArtist } | ||
/> | ||
</Grid> | ||
); | ||
}) } | ||
</Grid> | ||
</Stack> | ||
); | ||
}; | ||
|
||
export default ArtistSpotlight; | ||
|
||
const tempArtistData = [ | ||
{ | ||
imageUrl: | ||
"https://res.cloudinary.com/newm/image/upload/v1701715430/pzeo4bcivjouksomeggy.jpg", | ||
name: "Lorem Ipsum", | ||
songCount: 4, | ||
}, | ||
{ | ||
imageUrl: | ||
"https://res.cloudinary.com/newm/image/upload/c_limit,w_4000,h_4000/v1695587661/mprskynp42oijtpaypeq.jpg", | ||
name: "Lorem Ipsum", | ||
songCount: 4, | ||
}, | ||
{ | ||
imageUrl: | ||
"https://res.cloudinary.com/newm/image/upload/v1701715430/pzeo4bcivjouksomeggy.jpg", | ||
name: "Lorem Ipsum", | ||
songCount: 4, | ||
}, | ||
{ | ||
imageUrl: | ||
"https://res.cloudinary.com/newm/image/upload/c_limit,w_4000,h_4000/v1695587661/mprskynp42oijtpaypeq.jpg", | ||
name: "Lorem Ipsum", | ||
songCount: 4, | ||
}, | ||
{ | ||
imageUrl: | ||
"https://res.cloudinary.com/newm/image/upload/v1701715430/pzeo4bcivjouksomeggy.jpg", | ||
name: "Lorem Ipsum", | ||
songCount: 4, | ||
}, | ||
{ | ||
imageUrl: | ||
"https://res.cloudinary.com/newm/image/upload/c_limit,w_4000,h_4000/v1695587661/mprskynp42oijtpaypeq.jpg", | ||
name: "Lorem Ipsum", | ||
songCount: 4, | ||
}, | ||
{ | ||
imageUrl: | ||
"https://res.cloudinary.com/newm/image/upload/v1701715430/pzeo4bcivjouksomeggy.jpg", | ||
name: "Lorem Ipsum", | ||
songCount: 4, | ||
}, | ||
{ | ||
imageUrl: | ||
"https://res.cloudinary.com/newm/image/upload/c_limit,w_4000,h_4000/v1695587661/mprskynp42oijtpaypeq.jpg", | ||
name: "Lorem Ipsum", | ||
songCount: 4, | ||
}, | ||
]; |
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,5 +1,7 @@ | ||
export * from "./header"; | ||
export { Header } from "./header"; | ||
export * from "./footer/Footer"; | ||
export * from "./Songs"; | ||
export * from "./StyledComponentsRegistry"; | ||
export * from "./Artist"; | ||
export { default as Artist } from "./Artist"; | ||
export { default as ArtistSpotlight } from "./ArtistSpotlight"; | ||
export { default as Footer } from "./footer/Footer"; | ||
export { default as Header } from "./header/Header"; | ||
export { default as StyledComponentsRegistry } from "./StyledComponentsRegistry"; | ||
export { default as Songs } from "./Songs"; |
30 changes: 30 additions & 0 deletions
30
apps/marketplace/src/components/skeletons/ArtistSkeleton.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,30 @@ | ||
import { Box, Skeleton, Stack } from "@mui/material"; | ||
import { FunctionComponent } from "react"; | ||
|
||
interface ArtistSkeletonProps { | ||
readonly orientation: "row" | "column"; | ||
} | ||
|
||
const ArtistSkeleton: FunctionComponent<ArtistSkeletonProps> = ({ | ||
orientation, | ||
}) => ( | ||
<Stack spacing={ 1.25 }> | ||
<Box> | ||
<Skeleton | ||
sx={ { height: [150, 150, 200], width: [150, 150, 200] } } | ||
variant="circular" | ||
/> | ||
</Box> | ||
|
||
<Stack | ||
alignItems={ orientation === "column" ? "center" : "row" } | ||
direction={ orientation } | ||
spacing={ 0.25 } | ||
> | ||
<Skeleton height={ 30 } width={ 100 } /> | ||
<Skeleton height={ 20 } width={ 60 } /> | ||
</Stack> | ||
</Stack> | ||
); | ||
|
||
export default ArtistSkeleton; |
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
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
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
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 { styled } from "@mui/material/styles"; | ||
|
||
const Clickable = styled("button")` | ||
background: none; | ||
border: none; | ||
color: inherit; | ||
margin: 0; | ||
padding: 0; | ||
cursor: pointer; | ||
border-radius: 8px; | ||
&:hover * { | ||
text-decoration: underline; | ||
} | ||
`; | ||
|
||
export default Clickable; |
Oops, something went wrong.