[ui] create/add preliminaries
parent
57847facee
commit
5222734ce8
|
@ -6,6 +6,7 @@
|
||||||
import Home from "./views/Home.svelte";
|
import Home from "./views/Home.svelte";
|
||||||
import Browse from "./views/Browse.svelte";
|
import Browse from "./views/Browse.svelte";
|
||||||
import Search from "./views/Search.svelte";
|
import Search from "./views/Search.svelte";
|
||||||
|
import DropAdd from "./components/DropAdd.svelte";
|
||||||
|
|
||||||
const history = createHistory(createHashSource());
|
const history = createHistory(createHashSource());
|
||||||
|
|
||||||
|
@ -33,6 +34,8 @@
|
||||||
<Footer on:resize={setBottomMargin} />
|
<Footer on:resize={setBottomMargin} />
|
||||||
</Router>
|
</Router>
|
||||||
|
|
||||||
|
<DropAdd />
|
||||||
|
|
||||||
<style global lang="scss">
|
<style global lang="scss">
|
||||||
@use "normalize.css/normalize.css";
|
@use "normalize.css/normalize.css";
|
||||||
@use "styles/colors-app";
|
@use "styles/colors-app";
|
||||||
|
|
|
@ -0,0 +1,76 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import Icon from "./utils/Icon.svelte";
|
||||||
|
|
||||||
|
let dragging = false;
|
||||||
|
|
||||||
|
function onDrop(ev: DragEvent) {
|
||||||
|
console.log(ev.dataTransfer);
|
||||||
|
dragging = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function onDragEnter(ev: DragEvent) {
|
||||||
|
console.log("dragstart!");
|
||||||
|
}
|
||||||
|
|
||||||
|
function onDragOver(ev: DragEvent) {
|
||||||
|
dragging = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function onDragLeave(ev: DragEvent) {
|
||||||
|
console.log("dragleave!");
|
||||||
|
dragging = false;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<svelte:body
|
||||||
|
on:dragenter|preventDefault={onDragEnter}
|
||||||
|
on:dragover|preventDefault={onDragOver}
|
||||||
|
on:dragleave|preventDefault={onDragLeave}
|
||||||
|
on:drop|preventDefault={onDrop} />
|
||||||
|
|
||||||
|
<div class="dropindicator" class:dragging>
|
||||||
|
<div class="content">
|
||||||
|
<div class="icon">
|
||||||
|
<Icon name="current-location" />
|
||||||
|
</div>
|
||||||
|
<p>Drop an URL, an image or a file here!</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.dropindicator {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
background: rgba(0, 0, 0, 0.75);
|
||||||
|
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dragging {
|
||||||
|
display: unset;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
|
top: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
|
||||||
|
background: rgba(0, 0, 0, 0.9);
|
||||||
|
|
||||||
|
color: var(--foreground);
|
||||||
|
border: solid 0.25em var(--foreground);
|
||||||
|
border-radius: 0.5em;
|
||||||
|
padding: 1.5em;
|
||||||
|
|
||||||
|
text-align: center;
|
||||||
|
font-size: 32px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
font-size: 128px;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -29,10 +29,17 @@
|
||||||
</Link>
|
</Link>
|
||||||
</h1>
|
</h1>
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<Input placeholder="Search" value={searchQuery} on:input={onInput}>
|
<Input
|
||||||
|
placeholder="Search or add..."
|
||||||
|
value={searchQuery}
|
||||||
|
on:input={onInput}
|
||||||
|
>
|
||||||
<Icon name="search" slot="prefix" />
|
<Icon name="search" slot="prefix" />
|
||||||
</Input>
|
</Input>
|
||||||
</div>
|
</div>
|
||||||
|
<button class="add-button">
|
||||||
|
<Icon name="plus-circle" />
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
@ -73,5 +80,17 @@
|
||||||
margin-left: 1em;
|
margin-left: 1em;
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.add-button {
|
||||||
|
border: 1px solid var(--foreground);
|
||||||
|
border-radius: 4px;
|
||||||
|
background: var(--background-lighter);
|
||||||
|
color: var(--foreground);
|
||||||
|
margin: 0 0.5em;
|
||||||
|
padding: 0.25em 1em;
|
||||||
|
line-height: 1;
|
||||||
|
display: block;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue