Skip to content

Commit c1054b0

Browse files
authored
[MRKT-209][refactor](artist): Remove black gap on artist page with no banner. (#925)
* refactor(artist): make 'ProfileHeader' layout configurable and banner-agnostic * fix(marketplace/artist): render 'BannerImage' while loading * refactor(marketplace/artist): replace rem-based margin with theme spacing
1 parent 1b5f546 commit c1054b0

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

apps/marketplace/src/app/artist/[artistId]/page.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"use client";
2+
23
import { Container, Stack, Typography } from "@mui/material";
34
import { FunctionComponent, useState } from "react";
45
import { ProfileHeader, ProfileModal } from "@newm-web/components";
@@ -16,6 +17,10 @@ const Artist: FunctionComponent<ArtistProps> = ({ params }) => {
1617
const { isLoading, data: artist, error } = useGetArtistQuery(params.artistId);
1718
const [isAboutModalOpen, setIsAboutModalOpen] = useState(false);
1819

20+
const artistBannerUrl = artist?.bannerUrl;
21+
const showBannerArea = isLoading || !!artistBannerUrl;
22+
const profileHeaderLayout = showBannerArea ? "overlay" : "inline";
23+
1924
const socials = {
2025
instagramUrl: artist?.instagramUrl || "",
2126
itunesUrl: artist?.appleMusicProfile || "",
@@ -33,12 +38,15 @@ const Artist: FunctionComponent<ArtistProps> = ({ params }) => {
3338
return (
3439
<>
3540
<Stack direction="column">
36-
<BannerImage imageUrl={ artist?.bannerUrl } isLoading={ isLoading } />
41+
{ showBannerArea && (
42+
<BannerImage imageUrl={ artistBannerUrl } isLoading={ isLoading } />
43+
) }
3744

38-
<Container sx={ { flexGrow: 1 } }>
45+
<Container sx={ { flexGrow: 1, marginTop: showBannerArea ? 0 : 7 } }>
3946
<ProfileHeader
4047
isLoading={ isLoading }
4148
isVerified={ true }
49+
layout={ profileHeaderLayout }
4250
location={ artist?.location }
4351
name={ artist?.name }
4452
pictureUrl={ artist?.pictureUrl }

packages/components/src/lib/ProfileHeader.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import ProfileHeaderSkeleton from "./skeletons/ProfileHeaderSkeleton";
99
interface ProfileHeaderProps {
1010
readonly isLoading?: boolean;
1111
readonly isVerified?: boolean;
12+
readonly layout?: "overlay" | "inline";
1213
readonly location?: string;
1314
readonly name?: string;
1415
readonly onClickAbout: VoidFunction;
@@ -24,9 +25,12 @@ const ProfileHeader: FunctionComponent<ProfileHeaderProps> = ({
2425
socials,
2526
isLoading,
2627
isVerified = false,
28+
layout = "overlay",
2729
}) => {
2830
const theme = useTheme();
2931

32+
const isOverlay = layout === "overlay";
33+
3034
const isBelowMdBreakpoint = useBetterMediaQuery(
3135
`(max-width: ${theme.breakpoints.values.md}px)`
3236
);
@@ -40,7 +44,7 @@ const ProfileHeader: FunctionComponent<ProfileHeaderProps> = ({
4044
alignItems={ ["center", "center", "flex-start"] }
4145
direction={ ["column", "column", "row"] }
4246
justifyContent="space-between"
43-
mt={ [-12.5, -12.5, 0] }
47+
mt={ isOverlay ? [-12.5, -12.5, 0] : 0 }
4448
px={ 2.5 }
4549
>
4650
<Stack
@@ -110,7 +114,7 @@ const ProfileHeader: FunctionComponent<ProfileHeaderProps> = ({
110114
</Stack>
111115
</Stack>
112116

113-
<Box mt={ 2.5 }>
117+
<Box mt={ isOverlay ? 2.5 : isBelowMdBreakpoint ? 3 : -2 }>
114118
<Socials
115119
instagramUrl={ socials.instagramUrl }
116120
itunesUrl={ socials.itunesUrl }

0 commit comments

Comments
 (0)