feat(web): Rounded corners on selected assets (#3524)

* feat(web):  Rounded corners on selected assets

Add rounded corner on selected items and fix circle icon transparent background on selection

* refactor: Ran prettier to fix formatting issues
This commit is contained in:
Paul Thevenot 2023-08-03 16:11:21 +02:00 committed by GitHub
parent e4e049d040
commit 01210dceac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 3 deletions

View file

@ -30,7 +30,7 @@
class="object-cover transition duration-300 {border class="object-cover transition duration-300 {border
? 'border-[3px] border-immich-dark-primary/80 hover:border-immich-primary' ? 'border-[3px] border-immich-dark-primary/80 hover:border-immich-primary'
: ''}" : ''}"
class:rounded-lg={curve} class:rounded-xl={curve}
class:shadow-lg={shadow} class:shadow-lg={shadow}
class:rounded-full={circle} class:rounded-full={circle}
class:opacity-0={!thumbhash && !complete} class:opacity-0={!thumbhash && !complete}
@ -52,7 +52,7 @@
src={thumbHashToDataURL(Buffer.from(thumbhash, 'base64'))} src={thumbHashToDataURL(Buffer.from(thumbhash, 'base64'))}
alt={altText} alt={altText}
class="absolute top-0 object-cover" class="absolute top-0 object-cover"
class:rounded-lg={curve} class:rounded-xl={curve}
class:shadow-lg={shadow} class:shadow-lg={shadow}
class:rounded-full={circle} class:rounded-full={circle}
draggable="false" draggable="false"

View file

@ -96,7 +96,9 @@
{#if disabled} {#if disabled}
<CheckCircle size="24" class="text-zinc-800" /> <CheckCircle size="24" class="text-zinc-800" />
{:else if selected} {:else if selected}
<CheckCircle size="24" class="text-immich-primary" /> <div class="rounded-full bg-[#D9DCEF] dark:bg-[#232932]">
<CheckCircle size="24" class="text-immich-primary" />
</div>
{:else} {:else}
<CheckCircle size="24" class="text-white/80 hover:text-white" /> <CheckCircle size="24" class="text-white/80 hover:text-white" />
{/if} {/if}
@ -107,10 +109,12 @@
<div <div
class="absolute h-full w-full select-none bg-gray-100 transition-transform dark:bg-immich-dark-gray" class="absolute h-full w-full select-none bg-gray-100 transition-transform dark:bg-immich-dark-gray"
class:scale-[0.85]={selected} class:scale-[0.85]={selected}
class:rounded-xl={selected}
> >
<!-- Gradient overlay on hover --> <!-- Gradient overlay on hover -->
<div <div
class="absolute z-10 h-full w-full bg-gradient-to-b from-black/25 via-[transparent_25%] opacity-0 transition-opacity group-hover:opacity-100" class="absolute z-10 h-full w-full bg-gradient-to-b from-black/25 via-[transparent_25%] opacity-0 transition-opacity group-hover:opacity-100"
class:rounded-xl={selected}
/> />
<!-- Favorite asset star --> <!-- Favorite asset star -->
@ -141,6 +145,7 @@
widthStyle="{width}px" widthStyle="{width}px"
heightStyle="{height}px" heightStyle="{height}px"
thumbhash={asset.thumbhash} thumbhash={asset.thumbhash}
curve={selected}
/> />
{:else} {:else}
<div class="flex h-full w-full items-center justify-center p-4"> <div class="flex h-full w-full items-center justify-center p-4">
@ -153,6 +158,7 @@
<VideoThumbnail <VideoThumbnail
url={api.getAssetFileUrl(asset.id, false, true, publicSharedKey)} url={api.getAssetFileUrl(asset.id, false, true, publicSharedKey)}
enablePlayback={mouseOver} enablePlayback={mouseOver}
curve={selected}
durationInSeconds={timeToSeconds(asset.duration)} durationInSeconds={timeToSeconds(asset.duration)}
/> />
</div> </div>
@ -165,6 +171,7 @@
pauseIcon={MotionPauseOutline} pauseIcon={MotionPauseOutline}
playIcon={MotionPlayOutline} playIcon={MotionPlayOutline}
showTime={false} showTime={false}
curve={selected}
playbackOnIconHover playbackOnIconHover
/> />
</div> </div>

View file

@ -10,6 +10,7 @@
export let enablePlayback = false; export let enablePlayback = false;
export let playbackOnIconHover = false; export let playbackOnIconHover = false;
export let showTime = true; export let showTime = true;
export let curve = false;
export let playIcon = PlayCircleOutline; export let playIcon = PlayCircleOutline;
export let pauseIcon = PauseCircleOutline; export let pauseIcon = PauseCircleOutline;
@ -68,6 +69,7 @@
<video <video
bind:this={player} bind:this={player}
class="h-full w-full object-cover" class="h-full w-full object-cover"
class:rounded-xl={curve}
muted muted
autoplay autoplay
src={url} src={url}