Delete audio cover in Editor (#285)

This commit is contained in:
Ilya Y 2023-10-30 14:29:15 +03:00 committed by GitHub
parent 93cb38006b
commit bfb3fd570c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 2 deletions

View File

@ -213,6 +213,24 @@
background-position: center;
background-size: cover;
background-repeat: no-repeat;
position: relative;
.delete {
position: absolute;
width: 32px;
height: 32px;
padding: 10px;
border-radius: 50%;
top: 4px;
right: 4px;
background-color: rgba(black, 0.5);
cursor: pointer;
display: none;
}
&:hover .delete {
display: block;
}
}
}

View File

@ -24,6 +24,7 @@ import SimplifiedEditor from '../Editor/SimplifiedEditor'
import { isDesktop } from '../../utils/media-query'
import { TableOfContents } from '../TableOfContents'
import { getImageUrl } from '../../utils/getImageUrl'
import { Popover } from '../_shared/Popover'
type Props = {
shout: Shout
@ -365,7 +366,19 @@ export const EditView = (props: Props) => {
style={{
'background-image': `url(${getImageUrl(form.coverImageUrl, { width: 1600 })})`
}}
/>
>
<Popover content={t('Delete cover')}>
{(triggerRef: (el) => void) => (
<div
ref={triggerRef}
class={styles.delete}
onClick={() => setForm('coverImageUrl', null)}
>
<Icon name="close-white" />
</div>
)}
</Popover>
</div>
</Show>
</Show>
</div>

View File

@ -26,7 +26,7 @@ export type ShoutForm = {
selectedTopics: Topic[]
mainTopic?: Topic
body: string
coverImageUrl: string
coverImageUrl?: string
media?: string
}