-
Notifications
You must be signed in to change notification settings - Fork 220
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #946 from appwrite/storage-product-page
Storage product page
- Loading branch information
Showing
53 changed files
with
1,132 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
Oops, something went wrong.