diff --git a/aksel.nav.no/website/src/App.tsx b/aksel.nav.no/website/src/App.tsx index 9aebfa2..74a1e73 100644 --- a/aksel.nav.no/website/src/App.tsx +++ b/aksel.nav.no/website/src/App.tsx @@ -5,6 +5,7 @@ import { BodyShort, Button, Heading, + Link, Modal, TextField, } from "@navikt/ds-react"; @@ -72,6 +73,18 @@ export function App() { +
+ + Link + +
+ + Les mer om hvordan vi behandler data før du + søker, eller gå tilbake til forsiden. + +
+
+
Accordion diff --git a/packages/core/css/src/index.css b/packages/core/css/src/index.css index 549d81a..c26c87c 100644 --- a/packages/core/css/src/index.css +++ b/packages/core/css/src/index.css @@ -6,3 +6,4 @@ @import "./alert.css"; @import "./accordion.css"; @import "./modal.css"; +@import "./link.css"; diff --git a/packages/core/css/src/link.css b/packages/core/css/src/link.css new file mode 100644 index 0000000..393ebeb --- /dev/null +++ b/packages/core/css/src/link.css @@ -0,0 +1,26 @@ +/** + * Link + */ + +.navds-link { + color: var(--a-icon-action); + text-decoration: none; + text-underline-offset: 0.15em; +} + +.navds-link:hover { + text-decoration: underline; +} + +.navds-link--neutral { + color: var(--a-text-default); +} + +.navds-link--inline-text { + text-decoration: underline; +} + +.navds-link:focus-visible { + outline: 2px solid var(--a-border-focus); + outline-offset: 2px; +} diff --git a/packages/core/react/src/index.ts b/packages/core/react/src/index.ts index c9d2cf4..bfe02c1 100644 --- a/packages/core/react/src/index.ts +++ b/packages/core/react/src/index.ts @@ -12,3 +12,5 @@ export { Accordion, AccordionItem } from "./accordion"; export type { AccordionProps, AccordionItemProps } from "./accordion"; export { Modal } from "./modal"; export type { ModalProps } from "./modal"; +export { Link } from "./link"; +export type { LinkProps } from "./link"; diff --git a/packages/core/react/src/link/Link.tsx b/packages/core/react/src/link/Link.tsx new file mode 100644 index 0000000..37ac7c3 --- /dev/null +++ b/packages/core/react/src/link/Link.tsx @@ -0,0 +1,34 @@ +import { forwardRef } from "react"; +import type { AnchorHTMLAttributes } from "react"; +import { cn } from "../util/cn"; + +export interface LinkProps extends AnchorHTMLAttributes { + /** + * Link variant. + * @default "action" + */ + variant?: "action" | "neutral"; + /** + * Underlines the link so it reads as part of surrounding body text. + * @default false + */ + inlineText?: boolean; +} + +export const Link = forwardRef(function Link( + { variant = "action", inlineText = false, className, ...rest }, + ref, +) { + return ( + + ); +}); diff --git a/packages/core/react/src/link/index.ts b/packages/core/react/src/link/index.ts new file mode 100644 index 0000000..def0b70 --- /dev/null +++ b/packages/core/react/src/link/index.ts @@ -0,0 +1,2 @@ +export { Link } from "./Link"; +export type { LinkProps } from "./Link";