coomdev
2 years ago
7 changed files with 1101 additions and 489 deletions
File diff suppressed because it is too large
@ -0,0 +1,26 @@ |
|||
<script lang="ts"> |
|||
import { createEventDispatcher } from 'svelte' |
|||
|
|||
export let pos = [0, 0] |
|||
let visible = false |
|||
|
|||
export function toggle() { |
|||
visible = !visible |
|||
} |
|||
|
|||
export function setPos(p: [number, number]) { |
|||
//pos = p; |
|||
} |
|||
</script> |
|||
|
|||
{#if visible} |
|||
<div style="top: {pos[1]}px; left: {pos[0]}px" class="dialog"> |
|||
<slot /> |
|||
</div> |
|||
{/if} |
|||
|
|||
<style scoped> |
|||
.dialog { |
|||
position: relative; |
|||
} |
|||
</style> |
@ -0,0 +1,54 @@ |
|||
<script lang="ts"> |
|||
import { createEventDispatcher } from 'svelte' |
|||
|
|||
export let tag: string |
|||
export let toggleable = false |
|||
|
|||
export let toggled = false |
|||
|
|||
const dispatch = createEventDispatcher() |
|||
</script> |
|||
|
|||
<span |
|||
class:toggle={toggleable} |
|||
class:toggled={toggleable && toggled} |
|||
on:click={() => dispatch('toggle')} |
|||
class="tag" |
|||
> |
|||
{tag} |
|||
{#if toggleable} |
|||
<span on:click={e => (e.preventDefault(), dispatch('remove'))}>x</span> |
|||
{/if} |
|||
</span> |
|||
|
|||
<style scoped> |
|||
.tag { |
|||
padding: 5px; |
|||
border: 1px solid; |
|||
border-radius: 55px; |
|||
cursor: pointer; |
|||
display: inline-flex; |
|||
} |
|||
|
|||
.tag.toggled { |
|||
background-color: rgb(213, 255, 212); |
|||
} |
|||
|
|||
span.tag > span { |
|||
margin-left: 5px; |
|||
border-left: 1px solid; |
|||
padding-left: 5px; |
|||
} |
|||
|
|||
.tag.toggled:hover { |
|||
color: white; |
|||
background-color: rgb(255 156 156 / 80%); |
|||
color: white; |
|||
} |
|||
|
|||
.tag:not(.toggled):hover { |
|||
color: white; |
|||
background-color: rgb(213, 255, 212); |
|||
color: white; |
|||
} |
|||
</style> |
Loading…
Reference in new issue