Revert "New Table layout (#62)"

This reverts commit 5977de5d14.
This commit is contained in:
Andrey Platov 2021-08-26 09:51:00 +02:00
parent 5977de5d14
commit 1e6f81a9f3
No known key found for this signature in database
GPG Key ID: C8787EFEB4B64AF0
3 changed files with 88 additions and 106 deletions

View File

@ -80,9 +80,6 @@
--theme-button-border-focused: rgba(255, 255, 255, .4); --theme-button-border-focused: rgba(255, 255, 255, .4);
--theme-button-border-error: rgba(205, 104, 104, .1); --theme-button-border-error: rgba(205, 104, 104, .1);
--theme-table-bg-color: rgba(255, 255, 255, .02);
--theme-table-bg-hover: rgba(255, 255, 255, .04);
--theme-caption-color: #fff; --theme-caption-color: #fff;
--theme-content-accent-color: rgba(255, 255, 255, 0.8); --theme-content-accent-color: rgba(255, 255, 255, 0.8);
--theme-content-color: rgba(255, 255, 255, 0.6); --theme-content-color: rgba(255, 255, 255, 0.6);
@ -135,9 +132,6 @@
--theme-button-border-focused: rgba(255, 255, 255, .4); --theme-button-border-focused: rgba(255, 255, 255, .4);
--theme-button-border-error: rgba(205, 104, 104, .1); --theme-button-border-error: rgba(205, 104, 104, .1);
--theme-table-bg-color: rgba(255, 255, 255, .02);
--theme-table-bg-hover: rgba(255, 255, 255, .04);
--theme-caption-color: #fff; --theme-caption-color: #fff;
--theme-content-accent-color: rgba(255, 255, 255, 0.8); --theme-content-accent-color: rgba(255, 255, 255, 0.8);
--theme-content-color: rgba(255, 255, 255, 0.6); --theme-content-color: rgba(255, 255, 255, 0.6);
@ -189,9 +183,6 @@
--theme-button-border-focused: rgba(255, 255, 255, .4); --theme-button-border-focused: rgba(255, 255, 255, .4);
--theme-button-border-error: rgba(205, 104, 104, .1); --theme-button-border-error: rgba(205, 104, 104, .1);
--theme-table-bg-color: rgba(0, 0, 0, .02);
--theme-table-bg-hover: rgba(0, 0, 0, .04);
--theme-caption-color: #272121; --theme-caption-color: #272121;
--theme-content-accent-color: rgba(39, 33, 33, 0.8); --theme-content-accent-color: rgba(39, 33, 33, 0.8);
--theme-content-color: rgba(39, 33, 33, 0.6); --theme-content-color: rgba(39, 33, 33, 0.6);

View File

@ -52,19 +52,6 @@ select:-webkit-autofill:focus {
background: transparent; background: transparent;
} }
table, caption, tbody, tfoot, thead, tr, th, td {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: middle;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
// input:-webkit-autofill, // input:-webkit-autofill,
// input:-webkit-autofill:hover, // input:-webkit-autofill:hover,
// input:-webkit-autofill:focus, // input:-webkit-autofill:focus,

View File

@ -15,11 +15,12 @@
--> -->
<script lang="ts"> <script lang="ts">
import { createEventDispatcher } from 'svelte' import { createEventDispatcher } from 'svelte'
import type { Ref, Class, Doc, Space, FindOptions } from '@anticrm/core' import type { Ref, Class, Doc, Space, FindOptions } from '@anticrm/core'
import { buildModel } from '../utils' import { buildModel } from '../utils'
import { getClient } from '@anticrm/presentation' import { getClient } from '@anticrm/presentation'
import { Label, showModal, Loading, ScrollBox } from '@anticrm/ui' import { Label, showModal, Loading } from '@anticrm/ui'
import type { AnyComponent } from '@anticrm/ui' import type { AnyComponent } from '@anticrm/ui'
import { createQuery } from '@anticrm/presentation' import { createQuery } from '@anticrm/presentation'
@ -52,23 +53,19 @@
function onClick(object: Doc) { function onClick(object: Doc) {
showModal(open, { object, space }) showModal(open, { object, space })
} }
</script> </script>
{#await buildModel(client, _class, config, options)} {#await buildModel(client, _class, config, options)}
<Loading/> <Loading/>
{:then model} {:then model}
<div class="container">
<ScrollBox vertical stretch noShift>
<table class="table-body"> <table class="table-body">
<thead>
<tr class="tr-head"> <tr class="tr-head">
{#each model as attribute} {#each model as attribute}
<th><Label label = {attribute.label}/></th> <th><Label label = {attribute.label}/></th>
{/each} {/each}
</tr> </tr>
</thead>
{#if objects} {#if objects}
<tbody>
{#each objects as object (object._id)} {#each objects as object (object._id)}
<tr class="tr-body" on:click={() => onClick(object)}> <tr class="tr-body" on:click={() => onClick(object)}>
{#each model as attribute} {#each model as attribute}
@ -76,52 +73,59 @@
{/each} {/each}
</tr> </tr>
{/each} {/each}
</tbody>
{/if} {/if}
</table> </table>
</ScrollBox>
</div>
{/await} {/await}
<style lang="scss"> <style lang="scss">
.container { .table-body {
flex-grow: 1; display: table;
position: relative; border-collapse: collapse;
padding-bottom: 2.5rem;
&::before { td {
position: absolute; align-items: center;
content: ''; height: 4rem;
top: 2.5rem; padding: .375rem 1.25rem;
bottom: 0; color: var(--theme-content-accent-color);
width: 100%;
background-color: var(--theme-table-bg-color);
border-radius: 0 0 1.25rem 1.25rem;
} }
}
th, td {
padding: .5rem 1.5rem;
text-align: left;
&:first-child { padding-left: 2.5rem; }
}
th { th {
align-items: center;
height: 3.125rem;
padding: 0 1.25rem;
font-weight: 500;
text-align: left;
color: var(--theme-content-trans-color);
}
.tr-head {
position: sticky; position: sticky;
top: 0; top: 0;
height: 2.5rem;
font-weight: 500;
font-size: .75rem;
color: var(--theme-content-dark-color);
background-color: var(--theme-bg-color); background-color: var(--theme-bg-color);
box-shadow: inset 0 -1px 0 0 var(--theme-bg-focused-color); border-bottom: 1px solid var(--theme-bg-focused-color);
box-shadow: 0 1px 0 var(--theme-bg-focused-color);
z-index: 5;
} }
.tr-body { .tr-body {
height: 3.75rem; position: relative;
color: var(--theme-caption-color); border-top: 1px solid var(--theme-bg-accent-hover);
border-bottom: 1px solid var(--theme-button-border-hovered); &:nth-child(2) {
&:last-child { border-bottom: none; } border-top: 1px solid transparent;
&:hover { background-color: var(--theme-table-bg-hover); } }
&:last-child {
border-bottom: 1px solid transparent;
}
}
.tr-body:hover {
& > td {
border-top: 1px solid transparent;
border-bottom: 1px solid transparent;
background-color: var(--theme-button-bg-enabled);
&:first-child {
border-radius: 12px 0 0 12px;
}
&:last-child {
border-radius: 0 12px 12px 0;
}
}
}
} }
</style> </style>