Skip to content
This repository was archived by the owner on Nov 25, 2023. It is now read-only.

add editbox component with icon prop, remove finder component, fix space options #204

Merged
merged 4 commits into from
Jan 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/sparkling-controls/src/EditBox.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
-->

<script lang="ts">
export let width: string = '300px';
export let width: string = '300px'
export let value: string
export let placeholder: string
export let id: string
Expand Down
3 changes: 1 addition & 2 deletions packages/sparkling-theme/src/components/Theme.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,10 @@
.editbox {
border: 1px solid var(--theme-bg-dark-color);
border-radius: 4px;
padding: 1em 1em;
padding: 0.75em 1em;
background-color: var(--theme-bg-accent-color);
box-sizing: border-box;
color: var(--theme-content-color);
font: inherit;
transition: all .2s ease-in-out;

&:focus-within {
Expand Down
70 changes: 70 additions & 0 deletions plugins/platform-ui/src/components/EditBox.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<!--
// Copyright © 2020 Anticrm Platform Contributors.
//
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. You may
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
-->

<script lang="ts">
import Icon from './Icon.svelte'
import { Asset } from "@anticrm/platform-ui";

export let icon: Asset | undefined
export let width: string = '300px'
export let value: string
export let placeholder: string
export let right: boolean = false

let input: HTMLElement
</script>

<div class="editbox wIcon" style='width: {width}' on:click={input.focus()}>
{#if (!right)}
<Icon {icon} clazz="icon-embed" />
<div class="separator"></div>
{/if}
<input
bind:this={input}
type="text"
bind:value={value}
{placeholder}
on:input
on:focus
on:change
/>
{#if (right)}
<div class="separator"></div>
<Icon {icon} clazz="icon-embed" />
{/if}
</div>

<style lang="scss">
.wIcon {
display: flex;
flex-direction: row;
align-items: center;
}
.separator {
width: 7px;
}

input {
border: none;
width: 100%;
color: var(--theme-content-color);
background-color: transparent;
font: inherit;

&:focus {
outline: none;
}
}
</style>
11 changes: 11 additions & 0 deletions plugins/workbench/assets/icons.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion plugins/workbench/src/__meta__.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ export default (platform: Platform) => {
Pages: spritesUrl + '#pages',
Resize: spritesUrl + '#resize',
Close: spritesUrl + '#close',
Finder: spritesUrl + '#finder'
Finder: spritesUrl + '#finder',
Lock: spritesUrl + '#lock',
Sharp: spritesUrl + '#sharp',
Burger: spritesUrl + '#burger'
})
}
4 changes: 2 additions & 2 deletions plugins/workbench/src/components/internal/Application.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
import ScrollView from '@anticrm/sparkling-controls/src/ScrollView.svelte'
import Table from '@anticrm/presentation/src/components/internal/Table.svelte'
import Icon from '@anticrm/platform-ui/src/components/Icon.svelte'
import Finder from './Finder.svelte'
import ObjectForm from './ObjectForm.svelte'
import CreateForm from './CreateForm.svelte'
import { Ref } from '@anticrm/model'
import IconButton from '@anticrm/platform-ui/src/components/IconButton.svelte';
import EditBox from '@anticrm/platform-ui/src/components/EditBox.svelte';

export let application: Ref<WorkbenchApplication>
export let space: Ref<Space>
Expand Down Expand Up @@ -60,7 +60,7 @@
<IconButton icon={workbench.icon.Add} label={getLabel(appInstance.label)} />
</a>
<div style='flex-grow:1'></div>
<Finder placeholder='Поиск по {appInstance.label}...' />
<EditBox icon={workbench.icon.Finder} placeholder='Поиск по {appInstance.label}...' right='true' />
</div>
<ScrollView stylez='height:100%; margin: 2em'>
<div class='table'>
Expand Down
36 changes: 0 additions & 36 deletions plugins/workbench/src/components/internal/Finder.svelte

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import { _getCoreService, getPresentationService } from '../../../utils'
import CheckBox from '@anticrm/sparkling-controls/src/CheckBox.svelte'
import EditBox from '@anticrm/sparkling-controls/src/EditBox.svelte'

import EditIconBox from '@anticrm/platform-ui/src/components/EditBox.svelte'
import IconButton from '@anticrm/platform-ui/src/components/IconButton.svelte'
import workbench from '@anticrm/workbench'

Expand Down
39 changes: 24 additions & 15 deletions plugins/workbench/src/components/internal/spaces/SpaceItem.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
import { archivedSpaceUpdate, getCurrentUserSpace, getSpaceName, leaveSpace } from './utils'
import { _getCoreService, getUIService } from '../../../utils'
import SpaceOptions from './SpaceOptions.svelte'
import ToolbarButton from '@anticrm/sparkling-controls/src/toolbar/Button.svelte'
import Icon from '@anticrm/platform-ui/src/components/Icon.svelte'
import workbench from '../../..'

export let link: string = '/'
export let selected: boolean = false
Expand All @@ -24,23 +27,29 @@
}
</script>

<div class='spaces-space-item'>
<LinkTo href={link}>
<div class='item' class:selected={selected}>
{getSpaceName(space)}
<div class='separator'></div>
{#if count > 0}
<div class='counter'>{count}</div>
{/if}
{#if selected}
<div bind:this={optionsButton} class='options' on:click|preventDefault={() => {
<LinkTo href={link}>
<div class='item' class:selected={selected}>
{getSpaceName(space)}
<div class="separator"></div>
{#if count > 0}
<div class='counter'>{count}</div>
{/if}
{#if selected}
<div bind:this={optionsButton}>
<ToolbarButton style="padding:0; width:16px; height:16px"
on:click={() => {
uiService.showModal(SpaceOptions, {space}, optionsButton)
}}>
<Icon icon={workbench.icon.Burger} clazz="icon-embed" />
</ToolbarButton>
</div>
<!-- <div bind:this={optionsButton} class='options' on:click|preventDefault={() => {
uiService.showModal(SpaceOptions, {space}, optionsButton)
}}>︙
</div>
{/if}
</div>
</LinkTo>
</div>
</div> -->
{/if}
</div>
</LinkTo>

<style lang='scss'>
.spaces-space-item {
Expand Down
5 changes: 4 additions & 1 deletion plugins/workbench/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ export default plugin('workbench' as Plugin<WorkbenchService>, { core: core.id,
Pages: '' as Asset,
Resize: '' as Asset,
Close: '' as Asset,
Finder: '' as Asset
Finder: '' as Asset,
Lock: '' as Asset,
Sharp: '' as Asset,
Burger: '' as Asset
},
component: {
Workbench: '' as AnyComponent,
Expand Down