mirror of
https://github.com/strapi/strapi.git
synced 2025-09-05 06:43:07 +00:00
35 lines
774 B
JavaScript
35 lines
774 B
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import { useIntl } from 'react-intl';
|
|
import { Tooltip } from '@strapi/parts/Tooltip';
|
|
|
|
const LabelAction = ({ title, icon }) => {
|
|
const { formatMessage } = useIntl();
|
|
|
|
return (
|
|
<Tooltip description={formatMessage(title)}>
|
|
<button
|
|
aria-label={formatMessage(title)}
|
|
style={{
|
|
border: 'none',
|
|
padding: 0,
|
|
background: 'transparent',
|
|
}}
|
|
type="button"
|
|
>
|
|
{icon}
|
|
</button>
|
|
</Tooltip>
|
|
);
|
|
};
|
|
|
|
LabelAction.propTypes = {
|
|
icon: PropTypes.element.isRequired,
|
|
title: PropTypes.shape({
|
|
id: PropTypes.string.isRequired,
|
|
defaultMessage: PropTypes.string.isRequired,
|
|
}).isRequired,
|
|
};
|
|
|
|
export default LabelAction;
|