Add title to bullet

Signed-off-by: soupette <cyril@strapi.io>
This commit is contained in:
soupette 2021-09-21 09:02:33 +02:00
parent 509e38561c
commit 4fedad09c9

View File

@ -1,19 +1,9 @@
import React from 'react';
import PropTypes from 'prop-types';
// import { useIntl } from 'react-intl';
import { useIntl } from 'react-intl';
import styled from 'styled-components';
// import { Tooltip } from '@strapi/parts/Tooltip';
import { pxToRem } from '@strapi/helper-plugin';
// import { getTrad } from '../../../utils';
// TODO
// const CustomBullet = styled(Bullet)`
// width: ${pxToRem(6)};
// height: ${pxToRem(6)};
// * {
// fill: ${({ theme, $bulletColor }) => theme.colors[$bulletColor]};
// }
// `;
import { getTrad } from '../../../utils';
const statusMap = {
'did-not-create-locale': {
@ -28,12 +18,11 @@ const statusMap = {
},
};
// TODO
// const statusToTitleMap = {
// draft: 'content-manager.components.Select.draft-info-title',
// published: 'content-manager.components.Select.publish-info-title',
// 'did-not-create-locale': getTrad('components.Select.locales.not-available'),
// };
const statusToTitleMap = {
draft: 'content-manager.components.Select.draft-info-title',
published: 'content-manager.components.Select.publish-info-title',
'did-not-create-locale': getTrad('components.Select.locales.not-available'),
};
const StyledBullet = styled.div`
width: ${pxToRem(6)};
@ -41,19 +30,13 @@ const StyledBullet = styled.div`
border: ${({ theme, status }) => `1px solid ${theme.colors[statusMap[status].borderColor]}`};
background: ${({ theme, status }) => theme.colors[statusMap[status].backgroundColor]};
border-radius: 50%;
cursor: pointer;
`;
const Bullet = ({ status }) => {
// const { formatMessage } = useIntl();
const { formatMessage } = useIntl();
return <StyledBullet status={status} />;
// FIXME
// return (
// <Tooltip description={formatMessage({ id: statusToTitleMap[status] })}>
// <StyledBullet status={status} />
// </Tooltip>
// );
return <StyledBullet status={status} title={formatMessage({ id: statusToTitleMap[status] })} />;
};
Bullet.propTypes = {