fix(frontend): Make context clickable (#984)

* fix(frontend): Make context clickable

* fix(frontend): Fix buttons
This commit is contained in:
Faton Ramadani
2022-12-04 13:24:16 +01:00
committed by GitHub
parent 4a9e3ef983
commit 481441124f
3 changed files with 24 additions and 10 deletions
@@ -1,6 +1,7 @@
<script lang="ts">
import { Button, type ButtonType } from '$lib/components/common'
import type { InputsSpec } from '../../types'
import AlignWrapper from '../helpers/AlignWrapper.svelte'
import InputValue from '../helpers/InputValue.svelte'
import RunnableComponent from '../helpers/RunnableComponent.svelte'
@@ -12,6 +13,9 @@
export let componentInputs: InputsSpec
export let extraQueryParams: Record<string, any> = {}
export let horizontalAlignment: 'left' | 'center' | 'right' | undefined = undefined
export let verticalAlignment: 'top' | 'center' | 'bottom' | undefined = undefined
export const staticOutputs: string[] = ['loading', 'result']
let labelValue: string = 'Default label'
@@ -34,14 +38,15 @@
autoRefresh={false}
{extraQueryParams}
>
<Button
on:click={() => {
runnableComponent?.runComponent()
}}
btnClasses="w-full h-full"
{size}
{color}
<AlignWrapper {horizontalAlignment} {verticalAlignment}>
<Button
on:click={() => {
runnableComponent?.runComponent()
}}
{size}
{color}
>
{labelValue}
</Button></AlignWrapper
>
{labelValue}
</Button>
</RunnableComponent>
@@ -36,6 +36,7 @@ const buttons: ComponentSet = {
components: [
{
...defaultProps,
...defaultAlignement,
id: 'buttoncomponent',
type: 'buttoncomponent',
componentInputs: {
@@ -178,7 +178,15 @@
<PanelSection title="Outputs">
{#each Object.entries($staticOutputs) as [componentId, outputs], index}
{#if outputs.length > 0 && $worldStore?.outputsById[componentId]}
<Badge color="blue">Component: {componentId}</Badge>
<Button
btnClasses="bg-blue-100 text-blue-800 hover:bg-blue-200 !px-2 !py-1 text-xs focus:bg-blue-200"
size="xs"
spacingSize="xs"
on:click={() => ($selectedComponent = componentId)}
color="blue"
>
Component: {componentId}
</Button>
<div
class={classNames(