UNPKG

@itwin/core-react

Version:

A react component library of iTwin.js UI general purpose components

34 lines 1.63 kB
/*--------------------------------------------------------------------------------------------- * Copyright (c) Bentley Systems, Incorporated. All rights reserved. * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ /** @packageDocumentation * @module Button */ import "./UnderlinedButton.scss"; import classnames from "classnames"; import * as React from "react"; import { Key } from "ts-key-enum"; /** A React component that makes text clickable and underlined * @public * @deprecated in 4.13.0. Use {@link https://itwinui.bentley.com/docs/anchor iTwinUI anchor} or {@link https://itwinui.bentley.com/docs/button button} instead. */ // eslint-disable-next-line @typescript-eslint/no-deprecated export function UnderlinedButton(props) { const handleKeyUp = React.useCallback((event) => { const key = event.key; switch (key) { case Key.Enter.valueOf(): case " ": props.onActivate && props.onActivate(); break; } }, [props]); const handleClick = React.useCallback((e) => { props.onClick && props.onClick(e); props.onActivate && props.onActivate(); }, [props]); const className = classnames("core-underlined-button", props.className ? props.className : undefined); return (React.createElement("span", { className: className, title: props.title, onClick: handleClick, onKeyUp: handleKeyUp, tabIndex: 0, role: "link" }, props.children)); } //# sourceMappingURL=UnderlinedButton.js.map