Change Photo viewer controls and ButtonCircle

This commit is contained in:
2021-11-21 22:41:35 +01:00
parent 9e6df85bf1
commit 8e56d58b30
4 changed files with 44 additions and 25 deletions

View File

@@ -17,9 +17,7 @@
<button {type} {form} class={classes} on:click disabled={disabled}> <button {type} {form} class={classes} on:click disabled={disabled}>
{#if clone} {#if clone}
{#each Array(2) as _} {#each Array(2) as _}
<span class="clone">
<slot /> <slot />
</span>
{/each} {/each}
{:else} {:else}
<slot /> <slot />

View File

@@ -182,10 +182,10 @@
{/each} {/each}
<div class="viewer-photo__controls"> <div class="viewer-photo__controls">
<ButtonCircle on:click={goToPrevious} disabled={!canGoNext}> <ButtonCircle class="shadow-box-dark" disabled={!canGoNext} clone={true} on:click={goToPrevious}>
<IconArrow color="pink" flip={true} /> <IconArrow color="pink" flip={true} />
</ButtonCircle> </ButtonCircle>
<ButtonCircle on:click={goToNext} disabled={!canGoPrev}> <ButtonCircle class="shadow-box-dark" disabled={!canGoPrev} clone={true} on:click={goToNext}>
<IconArrow color="pink" /> <IconArrow color="pink" />
</ButtonCircle> </ButtonCircle>
</div> </div>

View File

@@ -14,25 +14,19 @@
width: 22px; width: 22px;
height: 22px; height: 22px;
object-fit: contain; object-fit: contain;
transition: opacity 0.4s var(--ease-quart), filter 0.4s var(--ease-quart); width: clamp(16px, 50%, 24px);
} height: clamp(16px, 50%, 24px);
// Clones
.clone {
display: flex;
justify-content: center;
align-items: center;
transform-origin: center center; transform-origin: center center;
transition: opacity 0.7s var(--ease-quart), transform 0.7s var(--ease-quart); transition: opacity 0.7s var(--ease-quart), transform 0.7s var(--ease-quart);
&:last-child { // Last clone
&:nth-child(2) {
position: absolute; position: absolute;
top: 0; z-index: 1;
left: 0; top: 50%;
width: 100%; left: 50%;
height: 100%;
opacity: 0; opacity: 0;
transform: translate3d(-100%, 0, 0); transform: translate3d(-150%, -50%, 0);
} }
} }
@@ -41,15 +35,15 @@
** States ** States
*/ */
// Hover // Hover
&:hover { &:not([disabled]):hover {
.clone { & > * {
&:first-child { &:first-child {
opacity: 0; opacity: 0;
transform: scale(0.9) translate3d(30%, 0, 0); transform: scale(0.75) translate3d(20%, 0, 0);
} }
&:last-child { &:last-child {
opacity: 1; opacity: 1;
transform: translate3d(0,0,0); transform: translate3d(-50%, -50%, 0);
} }
} }
} }
@@ -57,10 +51,10 @@
// Disabled // Disabled
&[disabled] { &[disabled] {
background: $color-primary; background: $color-primary;
border: 3px solid #ffffff20; border: 3px solid rgba(#fff, 0.2);
svg { svg {
fill: $color-primary-tertiary20; color: $color-primary-tertiary20;
} }
} }

View File

@@ -295,6 +295,33 @@
button { button {
pointer-events: auto; pointer-events: auto;
// Prev button
&:first-child {
& > *:nth-child(2) {
transform: translate3d(100%, -50%, 0) rotate(180deg);
}
// Hover
&:not([disabled]):hover {
& > *:nth-child(1) {
transform: translate3d(-20%, 0, 0) rotate(180deg);
}
& > *:nth-child(2) {
transform: translate3d(-50%, -50%, 0) rotate(180deg);
}
}
}
// Hover
&:not([disabled]):hover {
background-color: $color-secondary;
color: #fff;
svg:nth-child(2) {
color: #fff;
}
}
} }
} }
} }