Use icon instead of text for delete button

This commit is contained in:
René Pfeuffer
2020-10-02 08:55:40 +02:00
parent 4200aa1225
commit 2c507a7212
2 changed files with 8 additions and 7 deletions

View File

@@ -23,9 +23,8 @@
*/ */
import React, { FC } from "react"; import React, { FC } from "react";
import { DateFromNow, DeleteButton } from "@scm-manager/ui-components"; import { DateFromNow } from "@scm-manager/ui-components";
import { ApiKey } from "./SetApiKeys"; import { ApiKey } from "./SetApiKeys";
import { useTranslation } from "react-i18next";
import { Link } from "@scm-manager/ui-types"; import { Link } from "@scm-manager/ui-types";
type Props = { type Props = {
@@ -34,12 +33,14 @@ type Props = {
}; };
export const ApiKeyEntry: FC<Props> = ({ apiKey, onDelete }) => { export const ApiKeyEntry: FC<Props> = ({ apiKey, onDelete }) => {
const [t] = useTranslation("users");
let deleteButton; let deleteButton;
if (apiKey?._links?.delete) { if (apiKey?._links?.delete) {
deleteButton = ( deleteButton = (
<DeleteButton label={t("apiKey.delete")} action={() => onDelete((apiKey._links.delete as Link).href)} /> <a className="level-item" onClick={() => onDelete((apiKey._links.delete as Link).href)}>
<span className="icon is-small">
<i className="fas fa-trash" />
</span>
</a>
); );
} }
@@ -51,7 +52,7 @@ export const ApiKeyEntry: FC<Props> = ({ apiKey, onDelete }) => {
<td className="is-hidden-mobile"> <td className="is-hidden-mobile">
<DateFromNow date={apiKey.created}/> <DateFromNow date={apiKey.created}/>
</td> </td>
<td>{deleteButton}</td> <td className="is-darker">{deleteButton}</td>
</tr> </tr>
</> </>
); );

View File

@@ -45,7 +45,7 @@ const ApiKeyTable: FC<Props> = ({ apiKeys, onDelete }) => {
<thead> <thead>
<tr> <tr>
<th>{t("apiKey.displayName")}</th> <th>{t("apiKey.displayName")}</th>
<th>{t("apiKey.permissionRole")}</th> <th>{t("apiKey.permissionRole.label")}</th>
<th>{t("apiKey.created")}</th> <th>{t("apiKey.created")}</th>
<th /> <th />
</tr> </tr>