Skip to content

Commit 7f36555

Browse files
authored
fix(playlist): show image icon placeholder in Create Playlist artwork (#14425)
1 parent 55bfc54 commit 7f36555

4 files changed

Lines changed: 21 additions & 2 deletions

File tree

packages/web/src/components/create-playlist-modal/CreatePlaylistModal.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { getErrorMessage } from '@audius/common/utils'
99
import {
1010
Button,
1111
Flex,
12+
IconImage,
1213
IconPlaylists,
1314
Modal,
1415
ModalContent,
@@ -149,6 +150,7 @@ export const CreatePlaylistModal = () => {
149150
imageProcessingError={imageProcessingError}
150151
size='small'
151152
isUpload
153+
iconPlaceholder={<IconImage size='4xl' color='subdued' />}
152154
/>
153155
</Flex>
154156
<TextInput

packages/web/src/components/upload/UploadArtwork.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { ReactNode } from 'react'
2+
13
export type UploadArtworkProps = {
24
className?: string
35
artworkUrl?: string
@@ -12,6 +14,8 @@ export type UploadArtworkProps = {
1214
isImageAutogenerated?: boolean
1315
size: 'small' | 'large'
1416
isUpload?: boolean
17+
/** Rendered centered over the gray empty state when no artwork is set. */
18+
iconPlaceholder?: ReactNode
1519
}
1620

1721
declare const UploadArtwork = (props: UploadArtworkProps) => JSX.Element

packages/web/src/components/upload/UploadArtwork.jsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ const UploadArtwork = ({
2121
onRemoveArtwork,
2222
defaultPopupOpen = false,
2323
isImageAutogenerated = false,
24-
isUpload = false
24+
isUpload = false,
25+
iconPlaceholder
2526
}) => {
2627
const [processing, setProcessing] = useState(false)
2728
const [showTip, setShowTip] = useState(false)
@@ -63,11 +64,14 @@ const UploadArtwork = ({
6364
className={styles.artworkWrapper}
6465
style={{
6566
backgroundImage: `url(${
66-
artworkUrl || (processing ? '' : placeholderArt)
67+
artworkUrl || (processing || iconPlaceholder ? '' : placeholderArt)
6768
})`
6869
}}
6970
>
7071
{processing ? <LoadingSpinner className={styles.overlay} /> : null}
72+
{!artworkUrl && !processing && iconPlaceholder ? (
73+
<div className={styles.iconPlaceholder}>{iconPlaceholder}</div>
74+
) : null}
7175
</div>
7276
<div className={styles.button}>
7377
<Toast

packages/web/src/components/upload/UploadArtwork.module.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,12 @@
5353
.overlay > div {
5454
width: 56px !important;
5555
}
56+
57+
.iconPlaceholder {
58+
position: absolute;
59+
inset: 0;
60+
display: flex;
61+
align-items: center;
62+
justify-content: center;
63+
pointer-events: none;
64+
}

0 commit comments

Comments
 (0)