@atlaskit/rovo-agent-components
Version:
This package host public components related to rovo agents, the components here are needed for other public atlaskit packages
44 lines • 1.56 kB
JavaScript
/* index.tsx generated by @compiled/babel-plugin v0.39.1 */
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';
const styles = {
pressableStarIcon: "_bfhk1j28 _ca0qze3t _u5f3ze3t _n3tdze3t _19bvze3t _4t3i1tcg _1bsb1tcg",
hidden: "_tzy4idpf"
};
export const StarIconButton = ({
isStarred,
handleToggle,
visible = true,
agentName
}) => {
const {
formatMessage
} = useIntl();
const [isHovered, setIsHovered] = useState(false);
return /*#__PURE__*/React.createElement(Pressable, {
xcss: cx(styles.pressableStarIcon, !visible && styles.hidden),
onClick: handleToggle,
onMouseEnter: () => setIsHovered(true),
onMouseLeave: () => setIsHovered(false)
}, isStarred || isHovered ? /*#__PURE__*/React.createElement(StarIconMigration, {
spacing: "spacious",
label: formatMessage(messages.removeFromFavouritesLabel, {
agentName
}),
color: "var(--ds-icon-accent-orange, #E06C00)"
}) : /*#__PURE__*/React.createElement(StarUnstarredIconMigration, {
spacing: "spacious",
label: formatMessage(messages.clickToFavouriteLabel, {
agentName
}),
color: "var(--ds-icon, #292A2E)"
}));
};