diff --git a/apps/admin-ui/src/components/keycloak-card/ClickableCard.tsx b/apps/admin-ui/src/components/keycloak-card/ClickableCard.tsx new file mode 100644 index 0000000000..7ec3c14253 --- /dev/null +++ b/apps/admin-ui/src/components/keycloak-card/ClickableCard.tsx @@ -0,0 +1,32 @@ +import { KeyboardEvent } from "react"; +import { Card, CardProps } from "@patternfly/react-core"; + +type ClickableCardProps = Omit & { + onClick: () => void; +}; + +export const ClickableCard = ({ + children, + onClick, + ...rest +}: ClickableCardProps) => { + const onKeyDown = (e: KeyboardEvent) => { + if (e.key === " " || e.key === "Enter" || e.key === "Spacebar") { + onClick(); + } + }; + return ( + + {children} + + ); +}; diff --git a/apps/admin-ui/src/components/keycloak-card/KeycloakCard.tsx b/apps/admin-ui/src/components/keycloak-card/KeycloakCard.tsx index bb85c1a10a..27e9ed0c03 100644 --- a/apps/admin-ui/src/components/keycloak-card/KeycloakCard.tsx +++ b/apps/admin-ui/src/components/keycloak-card/KeycloakCard.tsx @@ -1,6 +1,5 @@ import { ReactElement, useState } from "react"; import { - Card, CardHeader, CardActions, CardTitle, @@ -15,6 +14,7 @@ import { import "./keycloak-card.css"; import { useRouteMatch } from "react-router-dom"; import { useNavigate } from "react-router-dom-v5-compat"; +import { ClickableCard } from "./ClickableCard"; export type KeycloakCardProps = { id: string; @@ -54,7 +54,7 @@ export const KeycloakCard = ({ }; return ( - + {dropdownItems && ( @@ -84,6 +84,6 @@ export const KeycloakCard = ({ - + ); }; diff --git a/apps/admin-ui/src/identity-providers/IdentityProvidersSection.tsx b/apps/admin-ui/src/identity-providers/IdentityProvidersSection.tsx index bd101ede40..b19931c946 100644 --- a/apps/admin-ui/src/identity-providers/IdentityProvidersSection.tsx +++ b/apps/admin-ui/src/identity-providers/IdentityProvidersSection.tsx @@ -8,7 +8,6 @@ import { Badge, Button, ButtonVariant, - Card, CardTitle, Dropdown, DropdownGroup, @@ -39,6 +38,7 @@ import { ManageOrderDialog } from "./ManageOrderDialog"; import { toIdentityProvider } from "./routes/IdentityProvider"; import { toIdentityProviderCreate } from "./routes/IdentityProviderCreate"; import helpUrls from "../help-urls"; +import { ClickableCard } from "../components/keycloak-card/ClickableCard"; export default function IdentityProvidersSection() { const { t } = useTranslation("identity-providers"); @@ -190,11 +190,8 @@ export default function IdentityProvidersSection() {
{sortBy(identityProviders[group], "name").map((provider) => ( - navigateToCreate(provider.id)} > @@ -206,7 +203,7 @@ export default function IdentityProvidersSection() { {provider.name} - + ))} diff --git a/apps/admin-ui/src/identity-providers/icons/FontAwesomeIcon.tsx b/apps/admin-ui/src/identity-providers/icons/FontAwesomeIcon.tsx index 0b1cfc7498..3442cc56dc 100644 --- a/apps/admin-ui/src/identity-providers/icons/FontAwesomeIcon.tsx +++ b/apps/admin-ui/src/identity-providers/icons/FontAwesomeIcon.tsx @@ -12,7 +12,6 @@ export const FontAwesomeIcon = ({ icon }: FontAwesomeIconProps) => { ); case "microsoft": @@ -20,7 +19,6 @@ export const FontAwesomeIcon = ({ icon }: FontAwesomeIconProps) => { ); case "instagram": @@ -28,16 +26,11 @@ export const FontAwesomeIcon = ({ icon }: FontAwesomeIconProps) => { ); case "paypal": return ( - + ); default: return null; diff --git a/apps/admin-ui/src/user-federation/UserFederationSection.tsx b/apps/admin-ui/src/user-federation/UserFederationSection.tsx index 5f8b75c457..d77eea9c39 100644 --- a/apps/admin-ui/src/user-federation/UserFederationSection.tsx +++ b/apps/admin-ui/src/user-federation/UserFederationSection.tsx @@ -1,7 +1,6 @@ import { AlertVariant, ButtonVariant, - Card, CardTitle, DropdownItem, Gallery, @@ -28,9 +27,10 @@ import { useRealm } from "../context/realm-context/RealmContext"; import { useServerInfo } from "../context/server-info/ServerInfoProvider"; import { toUpperCase } from "../util"; import { toProvider } from "./routes/NewProvider"; +import { ClickableCard } from "../components/keycloak-card/ClickableCard"; +import helpUrls from "../help-urls"; import "./user-federation.css"; -import helpUrls from "../help-urls"; export default function UserFederationSection() { const [userFederations, setUserFederations] = @@ -193,11 +193,8 @@ export default function UserFederationSection() {
{providers.map((p) => ( - navigate(toProvider({ realm, providerId: p.id! })) } @@ -216,7 +213,7 @@ export default function UserFederationSection() { - + ))}