Skip to content

Commit

Permalink
Merge pull request #946 from appwrite/storage-product-page
Browse files Browse the repository at this point in the history
Storage product page
  • Loading branch information
thejessewinton authored Nov 27, 2024
2 parents fe35810 + fa2ffbf commit 27a9eb9
Show file tree
Hide file tree
Showing 53 changed files with 1,132 additions and 60 deletions.
36 changes: 22 additions & 14 deletions src/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
--color-primary: hsl(var(--color-primary));
--color-secondary: hsl(var(--color-secondary));
--color-accent: var(--color-secondary);
--color-smooth: var(--color-smooth);

/* pink */
--color-pink-200: hsl(var(--color-pink-hue) 98% 84%);
Expand Down Expand Up @@ -45,6 +46,9 @@
--color-blue-500: calc(hsl(var(--color-blue-hue) - 1) 99% 70%);
--color-blue-700: calc(hsl(var(--color-blue-hue) - 1) 42% 42%);

/* green */
--color-green-700: #0a714f;

/* secondary */
--color-secondary-100: hsl(var(--color-secondary-hue) 99% 66%);
--color-accent-200: hsl(var(--color-secondary-hue), 78%, 60%, 0.32);
Expand All @@ -53,7 +57,7 @@
--color-white: hsl(0 0% 100%);
--color-black: hsl(0 0% 0%);
--color-transparent: rgba(0, 0, 0, 0);
--color-smooth: hsl(var(--color-greyscale-hue) 6%, 10%, 0.04);
--color-offset: hsl(var(--color-greyscale-hue) 2%, 11%, 0.94);
--color-greyscale-25: hsl(var(--color-greyscale-hue) 11% 98%);
--color-greyscale-50: hsl(var(--color-greyscale-hue) 11% 94%);
--color-greyscale-100: hsl(var(--color-greyscale-hue) 6% 90%);
Expand All @@ -77,10 +81,12 @@

/* Animations */
--animate-scale-in: scale-in 200ms ease-out forwards;
--animate-text: fade 0.75s ease-in-out both, blur 0.75s ease-in-out both,
--animate-caret-blink: caret-blink 1s ease-in-out infinite;
--animate-text: fade-in 0.75s ease-in-out both, blur 0.75s ease-in-out both,
up 0.75s ease-in-out both;
--animate-fade-in: fade 0.25s ease-in-out both;
--animate-fade-out: fade 0.25s ease-in-out both reverse;
--animate-scroll: scroll 60s linear infinite;
--animate-fade-in: fade-in 0.5s ease-in-out both;
--animate-marquee: marquee var(--speed, 30s) linear infinite var(--direction, forwards);

/* Pink polyfills */
--transition: 0.2s;
Expand Down Expand Up @@ -125,7 +131,7 @@
}
}

@keyframes fade {
@keyframes fade-in {
0% {
opacity: 0;
}
Expand All @@ -143,12 +149,11 @@
}
}

/* Animations */
--animate-scale-in: scale-in 200ms ease-out forwards;
--animate-caret-blink: caret-blink 1s ease-in-out infinite;
--animate-text: fade-in 0.75s ease-in-out both, blur 0.75s ease-in-out both,
up 0.75s ease-in-out both;
--animate-scroll: scroll 60s linear infinite;
@keyframes marquee {
to {
transform: translateX(-50%);
}
}

/* Fonts */
--font-family-sans: 'Inter', arial, sans-serif;
Expand All @@ -158,9 +163,12 @@
--font-family-archia: 'Archia', arial, sans-serif;

/* Font sizes */
--font-size-x-micro: 0.625rem;
--font-size-x-micro--line-height: 0.875rem;
--font-size-x-micro--letter-spacing: var(--letter-spacing-tighter);
--font-size-micro: 0.75rem;
--font-size-micro--line-height: 1rem;
--font-size-micro--letter-spacing: var(--letter-spacing-tight);
--font-size-micro--letter-spacing: var(--letter-spacing-tighter);
--font-size-caption: 0.875rem;
--font-size-caption--line-height: 1.375rem;
--font-size-caption--letter-spacing: var(--letter-spacing-tight);
Expand Down Expand Up @@ -218,18 +226,18 @@
--color-primary: var(--color-greyscale-900);
--color-secondary: var(--color-greyscale-700);
--color-accent: var(--color-pink-600);
--carousel-gradient: transparent;
--color-badge-bg: var(--color-badge-bg-light);
--color-badge-border: var(--color-badge-border-light);
--color-smooth: hsl(var(--color-greyscale-hue) 6%, 10%, 0.04);
}

/* dark theme */
.dark {
--color-primary: var(--color-greyscale-100);
--color-secondary: var(--color-greyscale-300);
--carousel-gradient: 23, 23, 26;
--color-badge-bg: var(--color-badge-bg-dark);
--color-badge-border: var(--color-badge-border-dark);
--color-smooth: hsl(0 0%, 100%, 0.06);
}

/* Container */
Expand Down
95 changes: 95 additions & 0 deletions src/lib/components/MultiCodeContextless.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<script lang="ts">
import { platformMap } from '$lib/utils/references';
import { writable } from 'svelte/store';
import { getCodeHtml, type Language } from '$lib/utils/code';
import { copy } from '$lib/utils/copy';
import { Select, Tooltip } from '$lib/components';
export let selected: Language = 'js';
export let data: { language: string; content: string; platform?: string }[] = [];
export let width: number | null = null;
export let height: number | null = null;
$: snippets = writable(new Set(data.map((d) => d.language)));
$: content = data.find((d) => d.language === selected)?.content ?? '';
$: platform = data.find((d) => d.language === selected)?.platform ?? '';
snippets?.subscribe((n) => {
if (selected === null && n.size > 0) {
selected = Array.from(n)[0] as Language;
}
});
enum CopyStatus {
Copy = 'Copy',
Copied = 'Copied!'
}
let copyText = CopyStatus.Copy;
async function handleCopy() {
await copy(content);
copyText = CopyStatus.Copied;
setTimeout(() => {
copyText = CopyStatus.Copy;
}, 1000);
}
$: result = getCodeHtml({
content,
language: selected ?? 'sh',
withLineNumbers: true
});
$: options = Array.from($snippets).map((language) => ({
value: language,
label: platformMap[language]
}));
</script>

<section
class="dark web-code-snippet mx-auto lg:!max-w-[90vw]"
aria-label="code-snippet panel"
style={`width: ${width ? width / 16 + 'rem' : 'inherit'}; height: ${
height ? height / 16 + 'rem' : 'inherit'
}`}
>
<header class="web-code-snippet-header">
<div class="web-code-snippet-header-start">
<div class="flex gap-4">
{#if platform}
<div class="web-tag"><span class="text">{platform}</span></div>
{/if}
</div>
</div>
<div class="web-code-snippet-header-end">
<ul class="buttons-list flex gap-3">
{#if $snippets.entries.length}
<li class="buttons-list-item flex self-center">
<Select bind:value={selected} bind:options />
</li>
{/if}
<li class="buttons-list-item" style="padding-inline-start: 13px">
<Tooltip>
<button
on:click={handleCopy}
class="web-icon-button"
aria-label="copy code from code-snippet"
><span class="web-icon-copy" aria-hidden="true" /></button
>
<svelte:fragment slot="tooltip">
{copyText}
</svelte:fragment>
</Tooltip>
</li>
</ul>
</div>
</header>
<div
class="web-code-snippet-content"
style={`height: ${height ? height / 16 + 'rem' : 'inherit'}`}
>
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
{@html result}
</div>
</section>
3 changes: 2 additions & 1 deletion src/lib/components/PreFooter.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { trackEvent } from '$lib/actions/analytics';
</script>

<img src="/images/bgs/pre-footer.png" alt="" class="web-pre-footer-bg" style="z-index:-1" />
<img src="/images/bgs/pre-footer.png" alt="" class="web-pre-footer-bg" loading="lazy" style="z-index:-1" />

<div class="web-u-row-gap-80 relative grid gap-8 md:grid-cols-2">
<section class="web-hero flex items-center justify-center gap-y-8">
Expand Down Expand Up @@ -152,5 +152,6 @@
height: auto;
max-inline-size: unset;
max-block-size: unset;
filter: blur(100px);
}
</style>
78 changes: 78 additions & 0 deletions src/lib/components/product-pages/hero.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<script lang="ts">
import { classNames } from '$lib/utils/classnames';
type $$Props = {
eyebrow: {
label: string;
icon: string;
};
title: string;
description: string;
cta: {
label: string;
url: string;
};
secondaryCta?: {
label: string;
url: string;
};
image: {
url: string;
alt?: string;
};
mobileImage?: {
url: string;
alt?: string;
};
};
export let eyebrow: $$Props['eyebrow'];
export let title: $$Props['title'];
export let description: $$Props['description'];
export let cta: $$Props['cta'];
export let secondaryCta: $$Props['secondaryCta'] = undefined;
export let image: $$Props['image'];
export let mobileImage: $$Props['mobileImage'] = undefined;
</script>

<div
class="border-smooth box-content flex items-center border-b bg-[url(/images/bgs/mobile-hero.png)] bg-cover bg-bottom py-12 px-5 md:bg-[url(/images/bgs/hero.png)] md:bg-center md:pt-32 md:pb-40 lg:px-8 xl:px-16"
>
<div class="mx-auto grid max-w-[75rem] items-center gap-16 md:grid-cols-2">
<div class="space-y-8">
<div class="flex items-center gap-2">
<img src={eyebrow.icon} class="size-8" alt="" />
<span class="text-micro font-aeonik-fono tracking-loose text-primary uppercase">
{eyebrow.label}<span class="web-u-color-text-accent">_</span>
</span>
</div>
<h1
class="text-display font-aeonik-pro text-primary text-pretty max-sm:max-w-[300px] md:max-w-md"
>
{title}
</h1>
<p class="text-description text-secondary text-pretty font-medium">
{description}
</p>

<div class="flex flex-col items-center gap-2 md:flex-row">
<a href={cta.url} class="web-button !w-full md:!w-fit">
{cta.label}
</a>
{#if secondaryCta}
<a href={secondaryCta.url} class="web-button is-secondary !w-full md:!w-fit">
{secondaryCta.label}
</a>
{/if}
</div>
</div>
<img
class={classNames({ 'hidden md:block': mobileImage })}
src={image.url}
alt={image.alt ?? ''}
/>
{#if mobileImage}
<img class="block md:hidden" src={mobileImage.url} alt={mobileImage.alt ?? ''} />
{/if}
</div>
</div>
75 changes: 75 additions & 0 deletions src/lib/components/product-pages/product-cards.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<script lang="ts">
const allProducts = {
messaging: {
title: 'Messaging',
description: 'Use Appwrite messaging to send email, SMS, and push notifications.',
icon: '/images/icons/illustrated/dark/messaging.png',
url: '/docs/products/messaging'
},
auth: {
title: 'Auth',
description: 'Build secure authentication and manage your users.',
icon: '/images/icons/illustrated/dark/auth.png',
url: '/docs/products/auth'
},
functions: {
title: 'Functions',
description: ' Scale big and unlock limitless potential with Appwrite functions.',
icon: '/images/icons/illustrated/dark/functions.png',
url: '/docs/products/functions'
},
databases: {
title: 'Databases',
description: 'Store and query structured data, ensuring scalable storage.',
icon: '/images/icons/illustrated/dark/databases.png',
url: '/docs/products/databases'
},
storage: {
title: 'Storage',
description: 'Manage your files project, using convenient APIs and utilities.',
icon: '/images/icons/illustrated/dark/storage.png',
url: '/docs/products/storage'
}
} as const;
export let exclude:
| 'messaging'
| 'functions'
| 'databases'
| 'storage'
| 'auth'
| 'realtime'
| undefined = undefined;
const products = Object.entries(allProducts)
.filter(([key]) => key !== exclude)
.map(([_, value]) => value);
</script>

<section class="border-smooth border-t py-20 md:py-40">
<div class="container">
<h4 class="text-label text-primary text-center">Keep exploring our products</h4>
<div class="mt-8 grid grid-cols-1 gap-8 md:grid-cols-2 lg:grid-cols-3">
{#each products as product}
<a
class="web-card is-normal"
href={product.url}
style="background: rgba(255, 255, 255, 0.04);"
>
<div
class="web-u-padding-inline-8 web-u-padding-block-end-8 flex flex-col gap-2"
>
<div class="flex items-center gap-2">
<img src={product.icon} alt="auth" width="32" height="32" />
<h4 class="text-body text-primary">{product.title}</h4>
<span class="web-icon-arrow-right ml-auto" aria-hidden="true" />
</div>
<p class="text-sub-body">
{product.description}
</p>
</div>
</a>
{/each}
</div>
</div>
</section>
Loading

0 comments on commit 27a9eb9

Please sign in to comment.