mirror of
https://github.com/logto-io/logto.git
synced 2025-02-17 22:04:19 -05:00
refactor(console): remove zero-colspan (#464)
This commit is contained in:
parent
58ab342c47
commit
eb1b20cdac
7 changed files with 15 additions and 7 deletions
|
@ -9,14 +9,15 @@ type Props = {
|
|||
title?: string;
|
||||
content?: string;
|
||||
children?: ReactNode;
|
||||
columns: number;
|
||||
};
|
||||
|
||||
const TableEmpty = ({ title, content, children }: Props) => {
|
||||
const TableEmpty = ({ title, content, children, columns }: Props) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<tr>
|
||||
<td colSpan={0}>
|
||||
<td colSpan={columns}>
|
||||
<div className={styles.tableEmpty}>
|
||||
<div>
|
||||
<img src={EmptyImage} />
|
||||
|
|
|
@ -10,14 +10,15 @@ type Props = {
|
|||
title?: string;
|
||||
content?: string;
|
||||
onRetry?: () => void;
|
||||
columns: number;
|
||||
};
|
||||
|
||||
const TableError = ({ title, content, onRetry }: Props) => {
|
||||
const TableError = ({ title, content, onRetry, columns }: Props) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<tr>
|
||||
<td colSpan={0}>
|
||||
<td colSpan={columns}>
|
||||
<div className={styles.tableError}>
|
||||
<div className={styles.image}>
|
||||
<img src={ErrorImage} />
|
||||
|
|
|
@ -76,13 +76,14 @@ const ApiResources = () => {
|
|||
<tbody>
|
||||
{error && (
|
||||
<TableError
|
||||
columns={2}
|
||||
content={error.body.message}
|
||||
onRetry={async () => mutate(undefined, true)}
|
||||
/>
|
||||
)}
|
||||
{isLoading && <TableLoading columns={2} />}
|
||||
{data?.length === 0 && (
|
||||
<TableEmpty>
|
||||
<TableEmpty columns={2}>
|
||||
<Button
|
||||
title="admin_console.api_resources.create"
|
||||
type="outline"
|
||||
|
|
|
@ -74,13 +74,14 @@ const Applications = () => {
|
|||
<tbody>
|
||||
{error && (
|
||||
<TableError
|
||||
columns={2}
|
||||
content={error.body.message}
|
||||
onRetry={async () => mutate(undefined, true)}
|
||||
/>
|
||||
)}
|
||||
{isLoading && <TableLoading columns={2} />}
|
||||
{data?.length === 0 && (
|
||||
<TableEmpty>
|
||||
<TableEmpty columns={2}>
|
||||
<Button
|
||||
title="admin_console.applications.create"
|
||||
type="outline"
|
||||
|
|
|
@ -82,6 +82,7 @@ const Connectors = () => {
|
|||
<tbody>
|
||||
{error && (
|
||||
<TableError
|
||||
columns={3}
|
||||
content={error.body.message}
|
||||
onRetry={async () => mutate(undefined, true)}
|
||||
/>
|
||||
|
@ -89,6 +90,7 @@ const Connectors = () => {
|
|||
{isLoading && <TableLoading columns={3} />}
|
||||
{socialConnectors?.length === 0 && (
|
||||
<TableEmpty
|
||||
columns={3}
|
||||
title={t('connectors.type.social')}
|
||||
content={t('connectors.social_connector_eg')}
|
||||
>
|
||||
|
|
|
@ -94,6 +94,7 @@ const UserConnectors = ({ userId, connectors, onDelete }: Props) => {
|
|||
<tbody>
|
||||
{error && (
|
||||
<TableError
|
||||
columns={3}
|
||||
content={error.body.message}
|
||||
onRetry={async () => mutate(undefined, true)}
|
||||
/>
|
||||
|
|
|
@ -76,13 +76,14 @@ const Users = () => {
|
|||
<tbody>
|
||||
{error && (
|
||||
<TableError
|
||||
columns={3}
|
||||
content={error.body.message}
|
||||
onRetry={async () => mutate(undefined, true)}
|
||||
/>
|
||||
)}
|
||||
{isLoading && <TableLoading columns={3} />}
|
||||
{users?.length === 0 && (
|
||||
<TableEmpty>
|
||||
<TableEmpty columns={3}>
|
||||
<Button
|
||||
title="admin_console.users.create"
|
||||
type="outline"
|
||||
|
|
Loading…
Add table
Reference in a new issue