0
Fork 0
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:
Wang Sijie 2022-03-29 17:54:29 +08:00 committed by GitHub
parent 58ab342c47
commit eb1b20cdac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 15 additions and 7 deletions

View file

@ -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} />

View file

@ -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} />

View file

@ -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"

View file

@ -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"

View file

@ -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')}
>

View file

@ -94,6 +94,7 @@ const UserConnectors = ({ userId, connectors, onDelete }: Props) => {
<tbody>
{error && (
<TableError
columns={3}
content={error.body.message}
onRetry={async () => mutate(undefined, true)}
/>

View file

@ -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"