mirror of
https://github.com/hcengineering/platform.git
synced 2025-02-09 04:18:33 +00:00
80 lines
2.3 KiB
Svelte
80 lines
2.3 KiB
Svelte
<!--
|
|
// 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 type { IntlString, Asset } from '@anticrm/platform'
|
|
import type { AnySvelteComponent } from '@anticrm/ui'
|
|
import { Icon, Tooltip } from '@anticrm/ui'
|
|
|
|
export let label: IntlString
|
|
export let icon: Asset | AnySvelteComponent
|
|
export let action: () => Promise<void>
|
|
export let selected: boolean
|
|
export let notify: boolean
|
|
</script>
|
|
|
|
<Tooltip {label}>
|
|
<button class="app" id={'app-' + label} class:selected={selected} on:click|stopPropagation={action}>
|
|
<div class="flex-center icon-container" class:noty={notify}>
|
|
<Icon icon={icon} size={'large'}/>
|
|
</div>
|
|
{#if notify}<div class="marker"/>{/if}
|
|
</button>
|
|
</Tooltip>
|
|
|
|
<style lang="scss">
|
|
.app {
|
|
position: relative;
|
|
padding: 0;
|
|
width: 3.25rem;
|
|
height: 3.25rem;
|
|
background-color: transparent;
|
|
border: 1px solid transparent;
|
|
border-radius: .5rem;
|
|
cursor: pointer;
|
|
outline: none;
|
|
|
|
.icon-container {
|
|
width: 3.25rem;
|
|
height: 3.25rem;
|
|
color: var(--theme-content-trans-color);
|
|
|
|
.normal-font &.noty { clip-path: url(#notify-normal); }
|
|
.small-font &.noty { clip-path: url(#notify-small); }
|
|
}
|
|
|
|
&:hover .icon-container { color: var(--theme-caption-color); }
|
|
&:focus {
|
|
border: 1px solid var(--primary-button-focused-border);
|
|
box-shadow: 0 0 0 3px var(--primary-button-outline);
|
|
.icon-container { color: var(--theme-caption-color); }
|
|
}
|
|
|
|
&.selected {
|
|
background-color: var(--theme-menu-selection);
|
|
.icon-container { color: var(--theme-caption-color); }
|
|
}
|
|
}
|
|
|
|
.marker {
|
|
position: absolute;
|
|
top: .75rem;
|
|
right: .75rem;
|
|
width: .5rem;
|
|
height: .5rem;
|
|
border-radius: 50%;
|
|
background-color: var(--highlight-red);
|
|
}
|
|
</style> |