💄(react) make DataGrid responsive
Previously the DataGrid was buggy in small width containers. Now it enables an horizontal scroll, in the future we will use cards instead.
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
.c__datagrid {
|
.c__datagrid {
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: flex-end;
|
align-items: flex-end;
|
||||||
gap: var(--c--theme--spacings--s);
|
gap: var(--c--theme--spacings--s);
|
||||||
position: relative;
|
position: relative;
|
||||||
|
container-type: inline-size;
|
||||||
|
|
||||||
&--empty {
|
&--empty {
|
||||||
min-height: 400px;
|
min-height: 400px;
|
||||||
@@ -15,43 +15,9 @@
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
&__loader {
|
&__table__container {
|
||||||
position: absolute;
|
width: 100%;
|
||||||
inset: 0;
|
overflow: scroll;
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
cursor: wait;
|
|
||||||
|
|
||||||
&__background {
|
|
||||||
position: absolute;
|
|
||||||
inset: 0;
|
|
||||||
background-color: var(--c--theme--colors--greyscale-100);
|
|
||||||
opacity: 0.5;
|
|
||||||
animation: pulse 1s infinite var(--c--theme--transitions--ease-out);
|
|
||||||
|
|
||||||
@keyframes pulse {
|
|
||||||
0% { opacity: 0.5; }
|
|
||||||
50% { opacity: 0.7; }
|
|
||||||
100% { opacity: 0.5; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.c__datagrid__empty-placeholder {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
gap: var(--c--theme--spacings--s);
|
|
||||||
|
|
||||||
img {
|
|
||||||
max-width: 400px;
|
|
||||||
width: 80%;
|
|
||||||
padding: 0.625rem;
|
|
||||||
border-radius: 0.625rem;
|
|
||||||
border: 1px var(--c--theme--colors--greyscale-300) solid;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
> table {
|
> table {
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
@@ -123,5 +89,46 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__loader {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
cursor: wait;
|
||||||
|
|
||||||
|
&__background {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
background-color: var(--c--theme--colors--greyscale-100);
|
||||||
|
opacity: 0.5;
|
||||||
|
animation: pulse 1s infinite var(--c--theme--transitions--ease-out);
|
||||||
|
|
||||||
|
@keyframes pulse {
|
||||||
|
0% { opacity: 0.5; }
|
||||||
|
50% { opacity: 0.7; }
|
||||||
|
100% { opacity: 0.5; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.c__datagrid__empty-placeholder {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
gap: var(--c--theme--spacings--s);
|
||||||
|
|
||||||
|
img {
|
||||||
|
max-width: 400px;
|
||||||
|
width: 80%;
|
||||||
|
padding: 0.625rem;
|
||||||
|
border-radius: 0.625rem;
|
||||||
|
border: 1px var(--c--theme--colors--greyscale-300) solid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -158,6 +158,7 @@ export const DataGrid = <T extends Row>({
|
|||||||
)}
|
)}
|
||||||
{!isEmpty && (
|
{!isEmpty && (
|
||||||
<>
|
<>
|
||||||
|
<div className="c__datagrid__table__container">
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
{displayHeader &&
|
{displayHeader &&
|
||||||
@@ -250,6 +251,7 @@ export const DataGrid = <T extends Row>({
|
|||||||
))}
|
))}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
</div>
|
||||||
{!!pagination && <Pagination {...pagination} />}
|
{!!pagination && <Pagination {...pagination} />}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user