UNPKG

@atlaskit/rovo-agent-components

Version:

This package host public components related to rovo agents, the components here are needed for other public atlaskit packages

51 lines 2.01 kB
/* index.tsx generated by @compiled/babel-plugin v0.39.1 */ import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; import "./index.compiled.css"; import * as React from 'react'; import { ax, ix } from "@compiled/react/runtime"; import { useState } from 'react'; import { useIntl } from 'react-intl'; import { cx } from '@atlaskit/css'; import StarIconMigration from '@atlaskit/icon/core/star-starred'; import StarUnstarredIconMigration from '@atlaskit/icon/core/star-unstarred'; import { Pressable } from '@atlaskit/primitives/compiled'; import messages from './messages'; var styles = { pressableStarIcon: "_bfhk1j28 _ca0qze3t _u5f3ze3t _n3tdze3t _19bvze3t _4t3i1tcg _1bsb1tcg", hidden: "_tzy4idpf" }; export var StarIconButton = function StarIconButton(_ref) { var isStarred = _ref.isStarred, handleToggle = _ref.handleToggle, _ref$visible = _ref.visible, visible = _ref$visible === void 0 ? true : _ref$visible, agentName = _ref.agentName; var _useIntl = useIntl(), formatMessage = _useIntl.formatMessage; var _useState = useState(false), _useState2 = _slicedToArray(_useState, 2), isHovered = _useState2[0], setIsHovered = _useState2[1]; return /*#__PURE__*/React.createElement(Pressable, { xcss: cx(styles.pressableStarIcon, !visible && styles.hidden), onClick: handleToggle, onMouseEnter: function onMouseEnter() { return setIsHovered(true); }, onMouseLeave: function onMouseLeave() { return setIsHovered(false); } }, isStarred || isHovered ? /*#__PURE__*/React.createElement(StarIconMigration, { spacing: "spacious", label: formatMessage(messages.removeFromFavouritesLabel, { agentName: agentName }), color: "var(--ds-icon-accent-orange, #E06C00)" }) : /*#__PURE__*/React.createElement(StarUnstarredIconMigration, { spacing: "spacious", label: formatMessage(messages.clickToFavouriteLabel, { agentName: agentName }), color: "var(--ds-icon, #292A2E)" })); };