Support empty dates and use CSS variables for easier styling

This commit is contained in:
Andrew Kingston 2023-02-21 11:51:52 +00:00
parent 57cfc9d84c
commit 3abc2ddbd1
3 changed files with 12 additions and 5 deletions

View File

@ -23,7 +23,9 @@
<div class="container"> <div class="container">
<div class="value"> <div class="value">
{dayjs(timeOnly ? time : value).format(format)} {#if value}
{dayjs(timeOnly ? time : value).format(format)}
{/if}
</div> </div>
{#if editable} {#if editable}
<Icon name="Calendar" /> <Icon name="Calendar" />

View File

@ -150,7 +150,7 @@
background: linear-gradient( background: linear-gradient(
to right, to right,
transparent 0%, transparent 0%,
var(--background) 40% var(--cell-background) 40%
); );
} }
.options { .options {

View File

@ -365,6 +365,10 @@
align-items: stretch; align-items: stretch;
border: 1px solid var(--spectrum-global-color-gray-400); border: 1px solid var(--spectrum-global-color-gray-400);
border-radius: 4px; border-radius: 4px;
/* Variables */
--cell-background: var(--spectrum-global-color-gray-50);
--cell-background-hover: var(--spectrum-global-color-gray-100);
} }
.spreadsheet { .spreadsheet {
display: grid; display: grid;
@ -382,7 +386,7 @@
} }
.wrapper ::-webkit-scrollbar-track { .wrapper ::-webkit-scrollbar-track {
background: var(--spectrum-global-color-gray-50); background: var(--cell-background);
} }
.controls { .controls {
@ -430,11 +434,12 @@
color: var(--spectrum-global-color-gray-900); color: var(--spectrum-global-color-gray-900);
font-size: 14px; font-size: 14px;
gap: 4px; gap: 4px;
background: var(--spectrum-global-color-gray-50); background: var(--cell-background);
position: relative; position: relative;
} }
.cell.hovered { .cell.hovered {
background: var(--spectrum-global-color-gray-100); background: var(--cell-background-hover);
--cell-background: var(--cell-background-hover);
} }
.cell.selected { .cell.selected {
box-shadow: inset 0 0 0 2px var(--spectrum-global-color-blue-400); box-shadow: inset 0 0 0 2px var(--spectrum-global-color-blue-400);