UNPKG

@atlaskit/side-navigation

Version:

A highly composable side navigation component that supports nested views.

51 lines (49 loc) • 2.36 kB
/* link-item.tsx generated by @compiled/babel-plugin v3.0.2 */ import _extends from "@babel/runtime/helpers/extends"; import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; var _excluded = ["href", "children", "className"]; import "./link-item.compiled.css"; import * as React from 'react'; import { ax, ix } from "@compiled/react/runtime"; import { forwardRef } from 'react'; import Link from '@atlaskit/menu/link-item'; import { useShouldNestedElementRender } from '../NestableNavigationContent/use-should-nested-element-render'; var styles = { root: "_2rkofajl _1rjcu2gc _18zru2gc _bfhksm61 _1a391k8s _racp1k8s _30l3azsu _irr31dpa _ppn2azsu _183jfcek", selectedStyles: "_bfhk15s3 _syaz6x5g _10536x5g _irr3ufnl _30l36x5g _1di6nozp _9h8h6x5g", rootMotion: "_v564hxmd _o7kshxmd _1ggl87vo", selectedMotion: "_v5641rrn _o7kshxmd _1ggl87vo" }; /** * __Link item__ * * Renders an item wrapped in an anchor tag, useful when you have an item that * should change routes using native browser navigation. For SPA transitions use * a [custom item](https://atlassian.design/components/side-navigation/examples#custom-item) * with the respective router logic. * * - [Examples](https://atlassian.design/components/side-navigation/examples#link-item) * - [Code](https://atlassian.design/components/side-navigation/code) * * @deprecated `@atlaskit/side-navigation` is deprecated. Use `@atlaskit/navigation-system` instead. */ export var LinkItem = /*#__PURE__*/forwardRef(function (_ref, ref) { var href = _ref.href, children = _ref.children, className = _ref.className, rest = _objectWithoutProperties(_ref, _excluded); var _useShouldNestedEleme = useShouldNestedElementRender(), shouldRender = _useShouldNestedEleme.shouldRender; if (!shouldRender) { return null; } // Anchor content will be handled by LinkItem return /*#__PURE__*/React.createElement(Link, _extends({ ref: ref, href: href // eslint-disable-next-line @atlaskit/design-system/no-unsafe-style-overrides , // eslint-disable-next-line @atlaskit/design-system/no-unsafe-style-overrides, @atlaskit/ui-styling-standard/no-classname-prop className: ax([styles.root, styles.rootMotion, rest.isSelected && styles.selectedStyles, rest.isSelected && styles.selectedMotion, className]) }, rest), children); });