Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { getErrorMessage } from '@audius/common/utils'
import {
Button,
Flex,
IconImage,
IconPlaylists,
Modal,
ModalContent,
Expand Down Expand Up @@ -149,6 +150,7 @@ export const CreatePlaylistModal = () => {
imageProcessingError={imageProcessingError}
size='small'
isUpload
iconPlaceholder={<IconImage size='4xl' color='subdued' />}
/>
</Flex>
<TextInput
Expand Down
4 changes: 4 additions & 0 deletions packages/web/src/components/upload/UploadArtwork.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { ReactNode } from 'react'

export type UploadArtworkProps = {
className?: string
artworkUrl?: string
Expand All @@ -12,6 +14,8 @@ export type UploadArtworkProps = {
isImageAutogenerated?: boolean
size: 'small' | 'large'
isUpload?: boolean
/** Rendered centered over the gray empty state when no artwork is set. */
iconPlaceholder?: ReactNode
}

declare const UploadArtwork = (props: UploadArtworkProps) => JSX.Element
Expand Down
8 changes: 6 additions & 2 deletions packages/web/src/components/upload/UploadArtwork.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ const UploadArtwork = ({
onRemoveArtwork,
defaultPopupOpen = false,
isImageAutogenerated = false,
isUpload = false
isUpload = false,
iconPlaceholder
}) => {
const [processing, setProcessing] = useState(false)
const [showTip, setShowTip] = useState(false)
Expand Down Expand Up @@ -63,11 +64,14 @@ const UploadArtwork = ({
className={styles.artworkWrapper}
style={{
backgroundImage: `url(${
artworkUrl || (processing ? '' : placeholderArt)
artworkUrl || (processing || iconPlaceholder ? '' : placeholderArt)
})`
}}
>
{processing ? <LoadingSpinner className={styles.overlay} /> : null}
{!artworkUrl && !processing && iconPlaceholder ? (
<div className={styles.iconPlaceholder}>{iconPlaceholder}</div>
) : null}
</div>
<div className={styles.button}>
<Toast
Expand Down
9 changes: 9 additions & 0 deletions packages/web/src/components/upload/UploadArtwork.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,12 @@
.overlay > div {
width: 56px !important;
}

.iconPlaceholder {
position: absolute;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
pointer-events: none;
}
Loading