budibase/packages/builder/src/pages/index.svelte

152 lines
3.0 KiB
Svelte
Raw Normal View History

<script>
2020-05-26 10:38:43 +02:00
import { getContext } from "svelte"
2020-05-07 11:53:34 +02:00
import { store } from "builderStore"
2020-04-02 15:16:46 +02:00
import AppList from "components/start/AppList.svelte"
import { onMount } from "svelte"
import ActionButton from "components/common/ActionButton.svelte"
2020-04-02 15:16:46 +02:00
import IconButton from "components/common/IconButton.svelte"
2020-05-26 10:38:43 +02:00
2020-04-02 15:16:46 +02:00
import Spinner from "components/common/Spinner.svelte"
let promise = getApps()
async function getApps() {
2020-05-14 16:12:30 +02:00
const res = await fetch(`/api/applications`)
const json = await res.json()
if (res.ok) {
return json
} else {
throw new Error(json)
}
}
2020-05-26 10:38:43 +02:00
// Handle create app modal
const { open } = getContext("simple-modal")
const showCreateAppModal = () => {
open(
Dialog,
{
message: "What is your name?",
hasForm: true,
onCancel,
onOkay,
},
{
closeButton: false,
closeOnEsc: false,
closeOnOuterClick: false,
}
)
}
</script>
2020-05-26 10:38:43 +02:00
<div class="welcome">Welcome to Budibase</div>
<div class="banner">
<div class="banner-content">
<div class="banner-header">
Every accomplishment starts with a decision to try.
</div>
2020-05-26 10:38:43 +02:00
<button class="banner-button" type="button">
<i class="ri-add-circle-fill" />
Create New Web App
</button>
</div>
2020-05-26 10:38:43 +02:00
<div class="banner-image">
<img src="/_builder/assets/banner-image.png" alt="Bannerimage" />
</div>
</div>
2020-05-26 10:38:43 +02:00
{#await promise}
<div class="spinner-container">
<Spinner />
</div>
{:then result}
<AppList apps={result} />
{:catch err}
<h1 style="color:red">{err}</h1>
{/await}
<style>
.welcome {
margin: 60px 80px 0px 80px;
font-size: 42px;
color: var(--ink);
font-weight: 900;
}
.banner {
display: grid;
grid-template-columns: 1fr 1fr;
margin: 20px 80px 40px 80px;
background-image: linear-gradient(-45deg, #7f9ceb, #1d2f77);
border-radius: 10px;
max-height: 280px;
}
.banner-content {
padding: 60px;
}
@media only screen and (min-width: 1800px) {
.banner-content {
padding: 80px;
}
}
.banner-header {
font-size: 24px;
color: var(--white);
font-weight: 500;
margin-bottom: 20px;
}
@media only screen and (min-width: 1800px) {
.banner-header {
font-size: 36px;
color: var(--white);
font-weight: 500;
margin-bottom: 20px;
}
}
.banner-image {
z-index: 1;
}
.banner-image img {
max-height: 400px;
}
.spinner-container {
height: 100%;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.banner-button {
background-color: var(--white);
color: var(--ink);
padding: 12px 20px;
border-radius: 5px;
border: 0px transparent solid;
font-size: 16px;
font-weight: 400;
cursor: pointer;
transition: all 0.2s;
box-sizing: border-box;
align-items: center;
display: flex;
}
.ri-add-circle-fill {
margin-right: 4px;
font-size: 24px;
}
.banner-button:hover {
background-color: var(--grey);
}
</style>