mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-19 22:24:11 +00:00
refactor: introduce empty placeholder
This commit is contained in:
committed by
Carlos Valente
parent
44f65b2fcc
commit
617e4b579b
@@ -163,6 +163,20 @@ $inner-padding: 1rem;
|
|||||||
animation: animloader 1s ease-in infinite;
|
animation: animloader 1s ease-in infinite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.empty {
|
||||||
|
background-color: $black-10;
|
||||||
|
text-align: center;
|
||||||
|
color: $muted-gray;
|
||||||
|
|
||||||
|
td {
|
||||||
|
padding: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
margin-top: 1rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@keyframes animloader {
|
@keyframes animloader {
|
||||||
0% {
|
0% {
|
||||||
transform: scale(0);
|
transform: scale(0);
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
import { HTMLAttributes, ReactNode } from 'react';
|
import { HTMLAttributes, ReactNode } from 'react';
|
||||||
|
import { Button } from '@chakra-ui/react';
|
||||||
|
import { IoAdd } from '@react-icons/all-files/io5/IoAdd';
|
||||||
|
|
||||||
import { cx } from '../../../common/utils/styleUtils';
|
import { cx } from '../../../common/utils/styleUtils';
|
||||||
|
|
||||||
@@ -52,8 +54,21 @@ export function Table({ className, children }: { className?: string; children: R
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ListGroup({ children }: { children: ReactNode }) {
|
export function TableEmpty({ handleClick }: { handleClick: () => void }) {
|
||||||
return <ul className={style.listGroup}>{children}</ul>;
|
return (
|
||||||
|
<tr className={style.empty}>
|
||||||
|
<td colSpan={99}>
|
||||||
|
<div>No data yet</div>
|
||||||
|
<Button onClick={handleClick} variant='ontime-subtle' rightIcon={<IoAdd />} size='sm'>
|
||||||
|
New
|
||||||
|
</Button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function ListGroup({ className, children }: { className?: string; children: ReactNode }) {
|
||||||
|
return <ul className={cx([style.listGroup, className])}>{children}</ul>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ListItem({ children }: { children: ReactNode }) {
|
export function ListItem({ children }: { children: ReactNode }) {
|
||||||
|
|||||||
@@ -149,6 +149,7 @@ export default function UrlPresetsForm() {
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
{fields.length === 0 && <Panel.TableEmpty handleClick={addNew} />}
|
||||||
{fields.map((preset, index) => {
|
{fields.map((preset, index) => {
|
||||||
const maybeAliasError = errors.data?.[index]?.alias?.message;
|
const maybeAliasError = errors.data?.[index]?.alias?.message;
|
||||||
const maybeUrlError = errors.data?.[index]?.pathAndParams?.message;
|
const maybeUrlError = errors.data?.[index]?.pathAndParams?.message;
|
||||||
|
|||||||
Reference in New Issue
Block a user