mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
feat: add cloud beta card page
This commit is contained in:
1 parent
0476e1a350
commit
1467d4f6dd
10 files changed
+697
-1
No files matched your search
Generated
+19
@@ -19,6 +19,7 @@
|
||||
"logrocket": "^3.0.1",
|
||||
"pretty-bytes": "^6.1.0",
|
||||
"prismjs": "^1.29.0",
|
||||
"svelte-confetti": "^1.2.2",
|
||||
"tippy.js": "^6.3.7",
|
||||
"web-vitals": "^3.1.1"
|
||||
},
|
||||
@@ -7973,6 +7974,24 @@
|
||||
"svelte": "^3.55.0"
|
||||
}
|
||||
},
|
||||
"node_modules/svelte-check/node_modules/typescript": {
|
||||
"version": "5.0.4",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz",
|
||||
"integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.20"
|
||||
}
|
||||
},
|
||||
"node_modules/svelte-confetti": {
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/svelte-confetti/-/svelte-confetti-1.2.2.tgz",
|
||||
"integrity": "sha512-LkvWO732jRNmYykWi0IOK7xoBX241p+p+tC7Ef1EcO3TK9b9lpB/vYqKkcwVya+onG2SgQsX2g+JVbVKxq5ixQ=="
|
||||
},
|
||||
"node_modules/svelte-hmr": {
|
||||
"version": "0.15.1",
|
||||
"resolved": "https://registry.npmjs.org/svelte-hmr/-/svelte-hmr-0.15.1.tgz",
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
"logrocket": "^3.0.1",
|
||||
"pretty-bytes": "^6.1.0",
|
||||
"prismjs": "^1.29.0",
|
||||
"svelte-confetti": "^1.2.2",
|
||||
"tippy.js": "^6.3.7",
|
||||
"web-vitals": "^3.1.1"
|
||||
},
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
import { readable, type Readable } from 'svelte/store';
|
||||
|
||||
function isCurrentWindowFocused(): boolean {
|
||||
if (!window) return false;
|
||||
if (!window.document) return false;
|
||||
if (typeof window.document.hasFocus !== 'function') return false;
|
||||
|
||||
return window.document.hasFocus();
|
||||
}
|
||||
|
||||
export function windowFocusStore(): Readable<boolean> {
|
||||
const visibility = readable(isCurrentWindowFocused(), (set) => {
|
||||
function handler() {
|
||||
set(isCurrentWindowFocused());
|
||||
}
|
||||
|
||||
if (window) {
|
||||
window.addEventListener('focus', handler);
|
||||
window.addEventListener('blur', handler);
|
||||
|
||||
return () => {
|
||||
window.removeEventListener('focus', handler);
|
||||
window.removeEventListener('blur', handler);
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
return visibility;
|
||||
}
|
||||
@@ -31,7 +31,8 @@ export const load: LayoutLoad = async ({ depends, url }) => {
|
||||
'/invite',
|
||||
'/auth/magic-url',
|
||||
'/auth/oauth2/success',
|
||||
'/auth/oauth2/failure'
|
||||
'/auth/oauth2/failure',
|
||||
'/cloud-beta-card'
|
||||
];
|
||||
|
||||
if (!acceptedRoutes.some((n) => url.pathname.startsWith(n))) {
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
showSideNavigation={$page.url.pathname !== '/console' &&
|
||||
!$page?.params.organization &&
|
||||
!$page.url.pathname.includes('/console/account') &&
|
||||
!$page.url.pathname.includes('/console/cloud-beta-card') &&
|
||||
!$page.url.pathname.includes('/console/onboarding')}>
|
||||
<Header slot="header" />
|
||||
<SideNavigation slot="side" />
|
||||
|
||||
@@ -0,0 +1,182 @@
|
||||
<script lang="ts">
|
||||
import { Confetti } from 'svelte-confetti';
|
||||
import Card from './Card.svelte';
|
||||
|
||||
let triggerConfettiKey = 1;
|
||||
const confettiColors = [
|
||||
'hsl(var(--color-primary-100))',
|
||||
'hsl(var(--color-primary-200))',
|
||||
'hsl(var(--color-primary-300))'
|
||||
];
|
||||
</script>
|
||||
|
||||
<div class="wrapper">
|
||||
<div class="card">
|
||||
<h3 class="heading-level-3">
|
||||
Join the celebration
|
||||
<button class="confetti-btn" on:click={() => triggerConfettiKey++}>
|
||||
🎉
|
||||
{#each Array(triggerConfettiKey) as _, i (i)}
|
||||
<Confetti
|
||||
delay={i === 0 ? [500, 500] : [0, 100]}
|
||||
x={[0.5, 2]}
|
||||
y={[0, 1.5]}
|
||||
amount="30"
|
||||
fallDistance="50px"
|
||||
colorArray={confettiColors} />
|
||||
{/each}
|
||||
</button>
|
||||
</h3>
|
||||
<div class="u-flex u-margin-block-start-40 u-cross-center u-gap-24">
|
||||
<img src="/images/cloud-beta-hoodies.png" alt="Cloud Beta hoodies" />
|
||||
<div>
|
||||
<div class="u-flex u-cross-center u-gap-8">
|
||||
<h4 class="eyebrow-heading-1">Cloud is live in public</h4>
|
||||
<h4 class="eyebrow-heading-1 beta-tag">Beta</h4>
|
||||
</div>
|
||||
<p class="u-margin-block-start-8">
|
||||
Share your Cloud card and you may win an exclusive Cloud hoodie!
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="buttons-list u-margin-block-start-32">
|
||||
<li class="buttons-list-item">
|
||||
<button class="button is-text">
|
||||
<span class="icon-twitter" aria-hidden="true" />
|
||||
<span class="text">Share</span>
|
||||
</button>
|
||||
</li>
|
||||
<li class="buttons-list-item">
|
||||
<button class="button is-text">
|
||||
<span class="icon-code" aria-hidden="true" />
|
||||
<span class="text">Get embed code</span>
|
||||
</button>
|
||||
</li>
|
||||
<li class="buttons-list-item">
|
||||
<button class="button is-text">
|
||||
<span class="icon-link" aria-hidden="true" />
|
||||
<span class="text">Get a link</span>
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="card-footer">
|
||||
<a href="/console" class="button">Back to console</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbc-wrapper">
|
||||
<!-- <div class="confetti-wrapper">
|
||||
<Confetti
|
||||
x={[-2, 2]}
|
||||
y={[-2.25, 1.25]}
|
||||
amount={50}
|
||||
size="10"
|
||||
delay={[0, 5000]}
|
||||
colorArray={confettiColors}
|
||||
fallDistance="50px" />
|
||||
</div> -->
|
||||
<Card />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
:global(.main-content) {
|
||||
flex-grow: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.wrapper {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
justify-content: center;
|
||||
flex-grow: 1;
|
||||
position: relative;
|
||||
|
||||
grid-template-columns: 600px 400px;
|
||||
padding-block: 4rem;
|
||||
gap: 8rem;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.card {
|
||||
max-width: 660px;
|
||||
|
||||
img {
|
||||
width: 159px;
|
||||
height: 118px;
|
||||
}
|
||||
|
||||
.beta-tag {
|
||||
background-color: hsl(var(--color-neutral-120));
|
||||
padding-inline: 0.75rem; // 12px
|
||||
padding-block: 0.25rem; // 4px
|
||||
border-radius: 0.375rem; // 6px
|
||||
}
|
||||
|
||||
p {
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.card-footer {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
|
||||
border-top: 1px solid hsl(var(--color-neutral-150));
|
||||
|
||||
margin-block-start: 2rem;
|
||||
padding-block-start: 2rem;
|
||||
margin-inline: -2rem;
|
||||
padding-inline: 2rem;
|
||||
}
|
||||
}
|
||||
|
||||
.cbc-wrapper {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.confetti-wrapper {
|
||||
position: relative;
|
||||
// z-index: 9999;
|
||||
}
|
||||
|
||||
@keyframes shake {
|
||||
0% {
|
||||
translate: 0;
|
||||
}
|
||||
25% {
|
||||
translate: 0 -4px;
|
||||
}
|
||||
50% {
|
||||
translate: 0 0px;
|
||||
}
|
||||
75% {
|
||||
translate: 0 0px;
|
||||
}
|
||||
100% {
|
||||
translate: 0 0px;
|
||||
}
|
||||
}
|
||||
|
||||
.confetti-btn {
|
||||
animation: shake 2000ms ease infinite;
|
||||
user-select: none;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
position: relative;
|
||||
|
||||
:global(.confetti-holder) {
|
||||
position: absolute !important;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
}
|
||||
|
||||
h3 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,463 @@
|
||||
<script lang="ts" context="module">
|
||||
// Helpers
|
||||
const round = (num: number, fix = 3) => parseFloat(num.toFixed(fix));
|
||||
const clamp = (num: number, min = -20, max = 20) => Math.min(Math.max(num, min), max);
|
||||
|
||||
function isTouchEvent(e: MouseEvent | TouchEvent): e is TouchEvent {
|
||||
return e.type === 'touchmove';
|
||||
}
|
||||
|
||||
function opacityFromDegree(degree: number): number {
|
||||
const degreeNormalized: number = degree % 360;
|
||||
const step: number = degreeNormalized % 180;
|
||||
|
||||
return step <= 90 ? step / 90 : 2 - step / 90;
|
||||
}
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import { windowFocusStore } from '$lib/stores/windowFocus';
|
||||
|
||||
import { onMount } from 'svelte';
|
||||
import { spring } from 'svelte/motion';
|
||||
|
||||
let cardEl: HTMLDivElement | undefined;
|
||||
let active = false;
|
||||
let interacting = false;
|
||||
|
||||
const springR = { stiffness: 0.066, damping: 0.25 };
|
||||
const springD = { stiffness: 0.033, damping: 0.45 };
|
||||
const THICKNESS = 6;
|
||||
|
||||
let springRotate = spring({ x: 0, y: 0 }, springR);
|
||||
let springGlare = spring({ x: 50, y: 50, o: 0.25 }, springR);
|
||||
let springBackground = spring({ x: 50, y: 50 }, springR);
|
||||
let springRotateDelta = spring({ x: 0, y: 0 }, springD);
|
||||
let springTranslate = spring({ x: 0, y: 0 }, springD);
|
||||
let springScale = spring(1, springD);
|
||||
let angle = 0;
|
||||
let centerProximity = spring(0, springR);
|
||||
let springRotateZ = spring(-15, springD);
|
||||
|
||||
let isBackwards = false;
|
||||
|
||||
// Events
|
||||
const interact = (e: MouseEvent | TouchEvent) => {
|
||||
if (!active) return;
|
||||
interacting = true;
|
||||
|
||||
const clientX = isTouchEvent(e) ? e.touches[0].clientX : e.clientX;
|
||||
const clientY = isTouchEvent(e) ? e.touches[0].clientY : e.clientY;
|
||||
|
||||
const el = e.target as HTMLElement;
|
||||
const rect = el.getBoundingClientRect(); // get element's current size/position
|
||||
const absolute = {
|
||||
x: clientX - rect.left, // get mouse position from left
|
||||
y: clientY - rect.top // get mouse position from right
|
||||
};
|
||||
const percent = {
|
||||
x: round((100 / rect.width) * absolute.x),
|
||||
y: round((100 / rect.height) * absolute.y)
|
||||
};
|
||||
const center = {
|
||||
x: percent.x - 50,
|
||||
y: (percent.y - 50) * (isBackwards ? -1 : 1)
|
||||
};
|
||||
|
||||
springBackground.stiffness = springR.stiffness;
|
||||
springBackground.damping = springR.damping;
|
||||
springBackground.set({
|
||||
x: round(50 + percent.x / 4 - 12.5),
|
||||
y: round(50 + percent.y / 3 - 16.67)
|
||||
});
|
||||
springRotate.stiffness = springR.stiffness;
|
||||
springRotate.damping = springR.damping;
|
||||
springRotate.set({
|
||||
x: round(-(center.x / 3.5)),
|
||||
y: round(center.y / 2)
|
||||
});
|
||||
springGlare.stiffness = springR.stiffness;
|
||||
springGlare.damping = springR.damping;
|
||||
springGlare.set({
|
||||
x: percent.x,
|
||||
y: percent.y,
|
||||
o: 1
|
||||
});
|
||||
|
||||
// get angle of mouse position relative to center of element
|
||||
angle = Math.atan2(center.y, center.x) * (180 / Math.PI);
|
||||
|
||||
// get proximity to center of element. 0 = center, 1 = edge
|
||||
$centerProximity = Math.sqrt(center.x * center.x + center.y * center.y) / 50 - 0.1;
|
||||
};
|
||||
|
||||
const interactEnd = (_: unknown, delay = 500) => {
|
||||
if (!active) return;
|
||||
setTimeout(function () {
|
||||
const snapStiff = 0.01;
|
||||
const snapDamp = 0.06;
|
||||
interacting = false;
|
||||
|
||||
springRotate.stiffness = snapStiff;
|
||||
springRotate.damping = snapDamp;
|
||||
springRotate.set({ x: 0, y: 0 });
|
||||
|
||||
springGlare.stiffness = snapStiff;
|
||||
springGlare.damping = snapDamp;
|
||||
springGlare.set({ x: 50, y: 50, o: 0 });
|
||||
|
||||
springBackground.stiffness = snapStiff;
|
||||
springBackground.damping = snapDamp;
|
||||
springBackground.set({ x: 50, y: 50 });
|
||||
$centerProximity = 0;
|
||||
}, delay);
|
||||
};
|
||||
|
||||
const setCenter = () => {
|
||||
if (!cardEl) return;
|
||||
const rect = cardEl.getBoundingClientRect(); // get element's size/position
|
||||
const view = document.documentElement; // get window/viewport size
|
||||
|
||||
const delta = {
|
||||
x: round(view.clientWidth / 2 - rect.x - rect.width / 2),
|
||||
y: round(view.clientHeight / 2 - rect.y - rect.height / 2)
|
||||
};
|
||||
springTranslate.set({
|
||||
x: delta.x,
|
||||
y: delta.y
|
||||
});
|
||||
};
|
||||
|
||||
const popover = () => {
|
||||
if (!cardEl) return;
|
||||
const rect = cardEl.getBoundingClientRect(); // get element's size/position
|
||||
let delay = 100;
|
||||
let scaleW = (window.innerWidth / rect.width) * 0.9;
|
||||
let scaleH = (window.innerHeight / rect.height) * 0.9;
|
||||
let scaleF = 1.75;
|
||||
setCenter();
|
||||
|
||||
delay = 1000;
|
||||
springRotateDelta.set({
|
||||
x: 360,
|
||||
y: 0
|
||||
});
|
||||
springRotateZ.set(0);
|
||||
|
||||
springScale.set(Math.min(scaleW, scaleH, scaleF));
|
||||
interactEnd(null, delay);
|
||||
};
|
||||
|
||||
const retreat = () => {
|
||||
springScale.set(1);
|
||||
springTranslate.set({ x: 0, y: 0 });
|
||||
springRotateDelta.set({ x: 0, y: 0 });
|
||||
springRotate.set({ x: 0, y: 0 });
|
||||
$centerProximity = 0;
|
||||
springRotateZ.set(-15);
|
||||
};
|
||||
|
||||
const handleClick = () => {
|
||||
active = !active;
|
||||
};
|
||||
|
||||
const handleBlur = () => {
|
||||
active = false;
|
||||
};
|
||||
|
||||
const windowKeyDown = (e: KeyboardEvent) => {
|
||||
if (!active) return;
|
||||
// If user presses q, rotate card
|
||||
if (e.key === 'q') {
|
||||
isBackwards = !isBackwards;
|
||||
}
|
||||
};
|
||||
|
||||
$: if (!active) {
|
||||
isBackwards = false;
|
||||
} else {
|
||||
springRotateDelta.update((old) => ({
|
||||
x: isBackwards ? 180 : 360,
|
||||
y: old.y
|
||||
}));
|
||||
}
|
||||
|
||||
// Reactive
|
||||
$: if (active) {
|
||||
popover();
|
||||
interacting = true;
|
||||
} else {
|
||||
retreat();
|
||||
}
|
||||
|
||||
windowFocusStore().subscribe((focused) => {
|
||||
if (focused) {
|
||||
active = false;
|
||||
springScale.set(1, { hard: true });
|
||||
springTranslate.set({ x: 0, y: 0 }, { hard: true });
|
||||
springRotateDelta.set({ x: 0, y: 0 }, { hard: true });
|
||||
springRotate.set({ x: 0, y: 0 }, { hard: true });
|
||||
springRotateZ.set(-15, { hard: true });
|
||||
centerProximity.set(0, { hard: true });
|
||||
}
|
||||
});
|
||||
|
||||
$: styles = `
|
||||
--mx: ${$springGlare.x}%;
|
||||
--my: ${$springGlare.y}%;
|
||||
--tx: ${$springTranslate.x}px;
|
||||
--ty: ${$springTranslate.y}px;
|
||||
--s: ${$springScale};
|
||||
--o: ${$springGlare.o};
|
||||
--rx: ${$springRotate.x + $springRotateDelta.x}deg;
|
||||
--ry: ${$springRotate.y + $springRotateDelta.y}deg;
|
||||
--rz: ${$springRotateZ}deg;
|
||||
--pos: ${$springBackground.x}% ${$springBackground.y}%;
|
||||
--posx: ${$springBackground.x}%;
|
||||
--posy: ${$springBackground.y}%;
|
||||
--hyp: ${clamp(
|
||||
Math.sqrt(
|
||||
($springGlare.y - 50) * ($springGlare.y - 50) +
|
||||
($springGlare.x - 50) * ($springGlare.x - 50)
|
||||
) / 50,
|
||||
0,
|
||||
1
|
||||
)};
|
||||
--angle: ${angle}deg;
|
||||
--center: ${$centerProximity};
|
||||
`;
|
||||
|
||||
// Lifecycle
|
||||
onMount(() => {
|
||||
let cb: number | null = null;
|
||||
const animate = () => {
|
||||
if (active) return (cb = window.requestAnimationFrame(animate));
|
||||
|
||||
// Rotate
|
||||
springRotate.update((old) => {
|
||||
const step = old.x % 360 > 90 && old.x % 360 < 270 ? 0.5 : 0.25;
|
||||
|
||||
return {
|
||||
...old,
|
||||
x: old.x + step * 4,
|
||||
y: 15
|
||||
};
|
||||
});
|
||||
|
||||
// Set glare opacity
|
||||
springGlare.update((old) => ({
|
||||
...old,
|
||||
x: 50,
|
||||
y: 50,
|
||||
o: opacityFromDegree(old.x)
|
||||
}));
|
||||
|
||||
cb = window.requestAnimationFrame(animate);
|
||||
};
|
||||
// animate();
|
||||
|
||||
return () => {
|
||||
cb && window.cancelAnimationFrame(cb);
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
<svelte:window on:keydown={windowKeyDown} />
|
||||
|
||||
<div class="cb-card" class:active class:interacting style={styles} bind:this={cardEl}>
|
||||
<div class="card__translater">
|
||||
<button
|
||||
class="card__rotator"
|
||||
aria-label="Expand the Card"
|
||||
tabindex="0"
|
||||
on:pointermove={interact}
|
||||
on:mouseout={interactEnd}
|
||||
on:click={handleClick}
|
||||
on:blur={handleBlur}>
|
||||
<div class="card__back">
|
||||
<img
|
||||
src="/images/back.png"
|
||||
alt="The back of the Card"
|
||||
loading="lazy"
|
||||
width="450"
|
||||
height="274" />
|
||||
<div class="card__glare" />
|
||||
</div>
|
||||
{#each new Array(THICKNESS) as _, i (i)}
|
||||
<div class="card__thick" style:--i={i + 1} />
|
||||
{/each}
|
||||
<div class="card__front" style:--thickness={THICKNESS}>
|
||||
<img src="/images/front.png" alt="The front of the card" />
|
||||
<div class="card__glare" />
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
:root {
|
||||
--mx: 50%;
|
||||
--my: 50%;
|
||||
--s: 1;
|
||||
--o: 0;
|
||||
--tx: 0px;
|
||||
--ty: 0px;
|
||||
--rx: 0deg;
|
||||
--ry: 0deg;
|
||||
--pos: 50% 50%;
|
||||
--posx: 50%;
|
||||
--posy: 50%;
|
||||
--hyp: 0;
|
||||
}
|
||||
|
||||
.cb-card {
|
||||
--radius: 12px;
|
||||
--back: white;
|
||||
--glow: var(--primary);
|
||||
z-index: calc(var(--s) * 100);
|
||||
transform: translate3d(0, 0, 0.1px);
|
||||
-webkit-transform: translate3d(0, 0, 0.1px);
|
||||
will-change: transform, visibility;
|
||||
transform-style: preserve-3d;
|
||||
-webkit-transform-style: preserve-3d;
|
||||
}
|
||||
|
||||
.cb-card.interacting {
|
||||
z-index: calc(var(--s) * 120);
|
||||
}
|
||||
|
||||
.cb-card.active .card__translater,
|
||||
.cb-card.active .card__rotator {
|
||||
touch-action: none;
|
||||
}
|
||||
|
||||
.card__translater,
|
||||
.card__rotator {
|
||||
display: grid;
|
||||
perspective: 600px;
|
||||
transform-origin: center;
|
||||
-webkit-transform-origin: center;
|
||||
will-change: transform;
|
||||
}
|
||||
|
||||
.card__translater {
|
||||
width: auto;
|
||||
position: relative;
|
||||
transform: translate3d(var(--tx), var(--ty), 0) scale(var(--s));
|
||||
-webkit-transform: translate3d(var(--tx), var(--ty), 0) scale(var(--s));
|
||||
}
|
||||
|
||||
.card__rotator {
|
||||
transform: rotateY(var(--rx)) rotateX(var(--ry)) rotateZ(var(--rz));
|
||||
transform-style: preserve-3d;
|
||||
-webkit-transform: rotateY(var(--rx)) rotateX(var(--ry)) rotateZ(var(--rz));
|
||||
-webkit-transform-style: preserve-3d;
|
||||
box-shadow: 0px 10px 20px -5px #14141f;
|
||||
border-radius: var(--radius);
|
||||
outline: none;
|
||||
transition: box-shadow 0.4s ease, outline 0.2s ease;
|
||||
}
|
||||
button.card__rotator {
|
||||
appearance: none;
|
||||
-webkit-appearance: none;
|
||||
border: none;
|
||||
background: top;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.card__thick {
|
||||
background-color: #1b1b28;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
transform: translateZ(calc(var(--i) * 1px));
|
||||
}
|
||||
|
||||
.cb-card.active .card__rotator {
|
||||
box-shadow: 0 0 10px 0px var(--glow), 0 0 10px 0px var(--glow), 0 0 30px 0px var(--glow);
|
||||
}
|
||||
|
||||
.card__rotator:focus {
|
||||
box-shadow: 0 0 10px 0px var(--glow), 0 0 10px 0px var(--glow), 0 0 30px 0px var(--glow);
|
||||
}
|
||||
|
||||
.cb-card.active .card__rotator:focus {
|
||||
box-shadow: 0px 10px 30px 3px #14141f;
|
||||
}
|
||||
|
||||
.card__rotator :global(*) {
|
||||
width: 100%;
|
||||
display: grid;
|
||||
grid-area: 1/1;
|
||||
border-radius: var(--radius);
|
||||
image-rendering: optimizeQuality;
|
||||
transform-style: preserve-3d;
|
||||
-webkit-transform-style: preserve-3d;
|
||||
}
|
||||
|
||||
.card__rotator img {
|
||||
outline: 1px solid transparent;
|
||||
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.card__back {
|
||||
background-color: var(--back);
|
||||
transform: rotateY(180deg) translateZ(0px);
|
||||
-webkit-transform: rotateY(180deg) translateZ(0px);
|
||||
backface-visibility: hidden;
|
||||
}
|
||||
|
||||
.card__front,
|
||||
.card__front * {
|
||||
backface-visibility: hidden;
|
||||
}
|
||||
|
||||
.card__front {
|
||||
opacity: 1;
|
||||
transition: opacity 0.33s ease-out;
|
||||
transform: translateZ(calc(var(--thickness) * 1px));
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.card__front::before {
|
||||
--resolved-angle: calc(var(--angle) + 65deg);
|
||||
}
|
||||
.card__back::before {
|
||||
--resolved-angle: calc(calc(var(--angle) * -1) + 60deg);
|
||||
}
|
||||
|
||||
.card__front::before,
|
||||
.card__back::before {
|
||||
/* Conic gradient */
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: conic-gradient(
|
||||
from var(--resolved-angle),
|
||||
rgba(255, 255, 255, 0) 0%,
|
||||
rgba(255, 255, 255, 1) 7.5%,
|
||||
rgba(255, 255, 255, 0) 15%
|
||||
);
|
||||
scale: 1.01;
|
||||
border-radius: calc(var(--radius) * 1.2);
|
||||
|
||||
opacity: var(--center);
|
||||
}
|
||||
|
||||
.card__glare {
|
||||
transform: translateZ(1px);
|
||||
z-index: 4;
|
||||
background: radial-gradient(
|
||||
farthest-corner circle at var(--mx) var(--my),
|
||||
rgba(255, 255, 255, 0.8) 10%,
|
||||
rgba(255, 255, 255, 0.65) 20%,
|
||||
rgba(0, 0, 0, 0.5) 90%
|
||||
);
|
||||
mix-blend-mode: overlay;
|
||||
opacity: calc(var(--o) * 0.25);
|
||||
}
|
||||
</style>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 111 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 88 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 248 KiB |
Reference in new issue
Block a user