From 828be4b8e64a99239b3d53b3105006744e3021c0 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Wed, 27 Jan 2021 14:53:50 +0000 Subject: [PATCH] file download icon + styling --- .../src/components/start/AppCard.svelte | 22 +++-- .../src/components/start/Steps/Info.svelte | 80 +++++++++++++++++-- packages/builder/src/pages/index.svelte | 14 +++- 3 files changed, 102 insertions(+), 14 deletions(-) diff --git a/packages/builder/src/components/start/AppCard.svelte b/packages/builder/src/components/start/AppCard.svelte index e032752bdd..5725de5973 100644 --- a/packages/builder/src/components/start/AppCard.svelte +++ b/packages/builder/src/components/start/AppCard.svelte @@ -32,11 +32,11 @@ Open {name} → - - {#if appExportLoading} - - {:else}Export{/if} - + {#if appExportLoading} + + {:else} + + {/if} @@ -54,7 +54,17 @@ .card-footer { display: flex; flex-direction: row; - align-items: baseline; + align-items: center; justify-content: space-between; } + + i { + font-size: var(--font-size-l); + cursor: pointer; + transition: 0.2s all; + } + + i:hover { + color: var(--blue); + } diff --git a/packages/builder/src/components/start/Steps/Info.svelte b/packages/builder/src/components/start/Steps/Info.svelte index 0052ff8b20..1a3a287ac5 100644 --- a/packages/builder/src/components/start/Steps/Info.svelte +++ b/packages/builder/src/components/start/Steps/Info.svelte @@ -2,22 +2,48 @@ import { Label, Heading, Input } from "@budibase/bbui" import Dropzone from "components/common/Dropzone.svelte" + const BYTES_IN_MB = 1000000 + const FILE_SIZE_LIMIT = BYTES_IN_MB * 5 + export let validationErrors export let template let blurred = { appName: false } - let files + let file - $: if (files) { - template.fileImportPath = files[0] + function handleFile(evt) { + const fileArray = Array.from(evt.target.files) + if (fileArray.some(file => file.size >= FILE_SIZE_LIMIT)) { + notifier.danger( + `Files cannot exceed ${FILE_SIZE_LIMIT / + BYTES_IN_MB}MB. Please try again with smaller files.` + ) + return + } + file = fileArray[0] + template.fileImportPath = file.path } -

Create your Web App

+{#if template.fromFile} +

Import Your Web App From A File

+{:else} +

Create your Web App

+{/if}
{#if template.fromFile}
- + +
+ + +
{:else if template}
@@ -44,4 +70,48 @@ /* Fix layout due to LH 0 on heading */ margin-bottom: 16px; } + + .dropzone { + text-align: center; + display: flex; + align-items: center; + flex-direction: column; + border-radius: 10px; + transition: all 0.3s; + } + + .uploaded { + color: var(--blue); + } + + input[type="file"] { + display: none; + } + + label { + font-family: var(--font-sans); + cursor: pointer; + font-weight: 500; + box-sizing: border-box; + overflow: hidden; + border-radius: var(--border-radius-s); + color: var(--ink); + padding: var(--spacing-m) var(--spacing-l); + transition: all 0.2s ease 0s; + display: inline-flex; + text-rendering: optimizeLegibility; + min-width: auto; + outline: none; + font-feature-settings: "case" 1, "rlig" 1, "calt" 0; + -webkit-box-align: center; + user-select: none; + flex-shrink: 0; + align-items: center; + justify-content: center; + width: 100%; + background-color: var(--grey-2); + font-size: var(--font-size-xs); + line-height: normal; + border: var(--border-transparent); + } diff --git a/packages/builder/src/pages/index.svelte b/packages/builder/src/pages/index.svelte index 5706665190..9905a15619 100644 --- a/packages/builder/src/pages/index.svelte +++ b/packages/builder/src/pages/index.svelte @@ -3,7 +3,7 @@ import AppList from "components/start/AppList.svelte" import { get } from "builderStore/api" import CreateAppModal from "components/start/CreateAppModal.svelte" - import { Button, Heading, Modal } from "@budibase/bbui" + import { Button, Heading, Modal, Spacer } from "@budibase/bbui" import TemplateList from "components/start/TemplateList.svelte" import analytics from "analytics" @@ -57,8 +57,11 @@
Welcome to the Budibase Beta - - +
+ + + +