Skip to content

Commit

Permalink
feat: add support for anchor elements (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas-jonas authored Nov 1, 2022
1 parent ea1f22e commit f738cac
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/react-components/ory/helpers/node.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { UiNode, UiNodeInputAttributes, UiText } from "@ory/client"
import {
getNodeLabel,
isUiNodeAnchorAttributes,
isUiNodeImageAttributes,
isUiNodeInputAttributes,
isUiNodeTextAttributes,
Expand All @@ -15,6 +16,7 @@ import { Image } from "../../image"
import { InputField } from "../../input-field"
import { Typography } from "../../typography"
import { NodeMessages } from "./error-messages"
import { ButtonLink } from "../../button-link"

interface ButtonSubmit {
type: "submit" | "reset" | "button" | undefined
Expand Down Expand Up @@ -214,6 +216,16 @@ export const Node = ({
/>
)
}
} else if (isUiNodeAnchorAttributes(node.attributes)) {
return (
<ButtonLink
href={node.attributes.href}
title={node.attributes.title.text}
data-testid={`node/anchor/${node.attributes.id}`}
>
{node.meta.label}
</ButtonLink>
)
}
return null
}

0 comments on commit f738cac

Please sign in to comment.