Standardise shadows across cell types

This commit is contained in:
Andrew Kingston 2023-04-17 15:41:55 +01:00
parent 4427b18466
commit 6c5ac00acb
3 changed files with 32 additions and 38 deletions

View File

@ -123,30 +123,24 @@
flex-direction: row; flex-direction: row;
justify-content: flex-start; justify-content: flex-start;
align-items: center; align-items: center;
height: calc(var(--row-height) - 12px); padding: 0 10px;
padding: 0 8px; color: var(--spectrum-global-color-gray-700);
color: var(--spectrum-global-color-gray-800);
border: 1px solid var(--spectrum-global-color-gray-300); border: 1px solid var(--spectrum-global-color-gray-300);
border-radius: 4px; border-radius: 4px;
text-transform: uppercase; text-transform: uppercase;
font-weight: 600; font-weight: 600;
font-size: 10px; font-size: 12px;
user-select: none; user-select: none;
} }
img {
height: auto;
/*height: calc(var(--row-height) - 12px);*/
/*max-width: 64px;*/
}
.dropzone { .dropzone {
position: absolute; position: absolute;
top: 100%; top: 100%;
left: 0; left: 0;
width: 320px; width: 320px;
background: var(--cell-background); background: var(--background);
border: var(--cell-border); border: var(--cell-border);
box-shadow: 0 0 8px 4px rgba(0, 0, 0, 0.15);
padding: var(--cell-padding); padding: var(--cell-padding);
box-shadow: 0 0 20px -4px rgba(0, 0, 0, 0.15);
} }
.dropzone.invertX { .dropzone.invertX {
left: auto; left: auto;

View File

@ -77,7 +77,13 @@
}) })
</script> </script>
<div class="container" class:multi class:editable class:open> <div
class="container"
class:multi
class:editable
class:open
on:click|self={editable ? open : null}
>
<div class="values" on:click={editable ? open : null}> <div class="values" on:click={editable ? open : null}>
{#each values as val} {#each values as val}
{@const color = getOptionColor(val)} {@const color = getOptionColor(val)}
@ -112,6 +118,7 @@
class="option" class="option"
on:click={() => toggleOption(option)} on:click={() => toggleOption(option)}
class:focused={focusedOptionIdx === idx} class:focused={focusedOptionIdx === idx}
on:mouseenter={() => (focusedOptionIdx = idx)}
> >
<div class="badge text" style="--color: {color}"> <div class="badge text" style="--color: {color}">
{option} {option}
@ -193,18 +200,18 @@
); );
} }
.options { .options {
min-width: 100%; min-width: calc(100% + 2px);
position: absolute; position: absolute;
top: 100%; top: 100%;
left: 0; left: -1px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
box-shadow: 4px 4px 10px 2px rgba(0, 0, 0, 0.1);
justify-content: flex-start; justify-content: flex-start;
align-items: stretch; align-items: stretch;
max-height: var(--max-cell-render-height); max-height: var(--max-cell-render-height);
overflow-y: auto; overflow-y: auto;
border: var(--cell-border); border: var(--cell-border);
box-shadow: 0 0 20px -4px rgba(0, 0, 0, 0.15);
} }
.options.invertX { .options.invertX {
left: auto; left: auto;
@ -222,7 +229,7 @@
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
gap: var(--cell-spacing); gap: var(--cell-spacing);
background-color: var(--cell-background-hover); background-color: var(--background);
} }
.option:hover, .option:hover,
.option.focused { .option.focused {

View File

@ -1,7 +1,7 @@
<script> <script>
import { getColor } from "../lib/utils" import { getColor } from "../lib/utils"
import { onMount, getContext } from "svelte" import { onMount, getContext } from "svelte"
import { Icon, Input } from "@budibase/bbui" import { Icon, Input, ProgressCircle } from "@budibase/bbui"
import { debounce } from "../../../utils/utils" import { debounce } from "../../../utils/utils"
export let value export let value
@ -24,6 +24,7 @@
let primaryDisplay let primaryDisplay
let candidateIndex let candidateIndex
let lastSearchId let lastSearchId
let searching = false
$: oneRowOnly = schema?.relationshipType === "one-to-many" $: oneRowOnly = schema?.relationshipType === "one-to-many"
$: editable = focused && !readonly $: editable = focused && !readonly
@ -74,6 +75,7 @@
// Search for results, using IDs to track invocations and ensure we're // Search for results, using IDs to track invocations and ensure we're
// handling the latest update // handling the latest update
lastSearchId = Math.random() lastSearchId = Math.random()
searching = true
const thisSearchId = lastSearchId const thisSearchId = lastSearchId
const results = await API.searchTable({ const results = await API.searchTable({
paginate: false, paginate: false,
@ -85,6 +87,7 @@
}, },
}, },
}) })
searching = false
// In case searching takes longer than our debounced update, abandon these // In case searching takes longer than our debounced update, abandon these
// results // results
@ -249,13 +252,11 @@
placeholder={primaryDisplay ? `Search by ${primaryDisplay}` : null} placeholder={primaryDisplay ? `Search by ${primaryDisplay}` : null}
/> />
</div> </div>
{#if searchString && searchResults} {#if searching}
<div class="info"> <div class="searching">
{searchResults.length} row{searchResults.length === 1 ? "" : "s"} found <ProgressCircle size="S" />
</div> </div>
{/if} {:else if searchResults?.length}
{#if searchResults?.length}
<div class="results"> <div class="results">
{#each searchResults as row, idx} {#each searchResults as row, idx}
<div <div
@ -379,13 +380,12 @@
var(--max-cell-render-height) + var(--row-height) - var(--max-cell-render-height) + var(--row-height) -
var(--max-relationship-height) var(--max-relationship-height)
); );
background: var(--cell-background); background: var(--background);
border: var(--cell-border); border: var(--cell-border);
box-shadow: 0 0 8px 4px rgba(0, 0, 0, 0.15); box-shadow: 0 0 20px -4px rgba(0, 0, 0, 0.15);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: stretch; align-items: stretch;
background-color: var(--cell-background-hover);
} }
.dropdown.invertY { .dropdown.invertY {
transform: translateY(-100%); transform: translateY(-100%);
@ -396,6 +396,11 @@
right: 0; right: 0;
} }
.searching {
padding: var(--cell-padding);
display: flex;
justify-content: center;
}
.results { .results {
overflow-y: auto; overflow-y: auto;
overflow-x: hidden; overflow-x: hidden;
@ -436,16 +441,4 @@
.search :global(.spectrum-Form-item) { .search :global(.spectrum-Form-item) {
flex: 1 1 auto; flex: 1 1 auto;
} }
.info {
color: var(--spectrum-global-color-gray-600);
font-size: 12px;
padding: 4px var(--cell-padding);
flex: 0 0 auto;
display: flex;
align-items: center;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
</style> </style>