@oslokommune/punkt-react
Version:
React komponentbibliotek til Punkt, et designsystem laget av Oslo Origo
27 lines (26 loc) • 1.25 kB
TypeScript
/**
* External-link labelling for the global footer.
*
* Punkt's link-labelling guidance (punkt.oslo.kommune.no/god-praksis/merking-av-lenker/)
* prefers spelling out the destination domain in parentheses after the link
* text — "Ledige stillinger (webcruiter.com)" — over an external-link icon.
*/
/**
* Return the top domain of an absolute http(s) URL, or `undefined` for
* relative URLs, fragments, and non-web schemes (`mailto:`, `tel:`).
* Unlike `getExternalDomainLabel` this does no internal-host check — use
* it when the consumer has explicitly flagged the link as external.
*/
export declare function getLinkDomainLabel(url: string | undefined): string | undefined;
/**
* Return the top domain to display after an external link's text, or
* `undefined` when the link needs no label:
*
* - relative URLs and fragments (`/jobb`, `#cb-trigger`) — same site
* - non-http(s) schemes (`mailto:`, `tel:`) — not web navigation
* - hosts on `oslo.kommune.no` (or a subdomain) — internal
*
* `internalHost` can widen what counts as internal, e.g. for consumers
* hosting the payload themselves.
*/
export declare function getExternalDomainLabel(url: string | undefined, internalHost?: string): string | undefined;