mirror of
https://github.com/plankanban/planka.git
synced 2025-12-27 09:14:59 +03:00
ref: Little refactoring
This commit is contained in:
@@ -1,30 +0,0 @@
|
||||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
import React, { useCallback, useState } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Icon } from 'semantic-ui-react';
|
||||
|
||||
import styles from './Favicon.module.scss';
|
||||
|
||||
const Favicon = React.memo(({ url }) => {
|
||||
const [isImageError, setIsImageError] = useState(false);
|
||||
|
||||
const handleImageError = useCallback(() => {
|
||||
setIsImageError(true);
|
||||
}, []);
|
||||
|
||||
return isImageError ? (
|
||||
<Icon fitted name="linkify" className={styles.fallbackIcon} />
|
||||
) : (
|
||||
<img src={url} onError={handleImageError} /> // eslint-disable-line jsx-a11y/alt-text
|
||||
);
|
||||
});
|
||||
|
||||
Favicon.propTypes = {
|
||||
url: PropTypes.string.isRequired,
|
||||
};
|
||||
|
||||
export default Favicon;
|
||||
@@ -1,11 +0,0 @@
|
||||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
:global(#app) {
|
||||
.fallbackIcon {
|
||||
color: #5e6c84;
|
||||
font-size: 18px;
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@ import { usePopupInClosableContext } from '../../../hooks';
|
||||
import { isListArchiveOrTrash } from '../../../utils/record-helpers';
|
||||
import { AttachmentTypes, BoardMembershipRoles } from '../../../constants/Enums';
|
||||
import EditStep from './EditStep';
|
||||
import Favicon from './Favicon';
|
||||
import Favicon from '../../common/Favicon';
|
||||
import TimeAgo from '../../common/TimeAgo';
|
||||
|
||||
import styles from './ItemContent.module.scss';
|
||||
@@ -131,7 +131,11 @@ const ItemContent = React.forwardRef(({ id, onOpen }, ref) => {
|
||||
<span className={styles.options}>
|
||||
<button type="button" className={styles.option} onClick={handleDownloadClick}>
|
||||
<Icon name="download" size="small" className={styles.optionIcon} />
|
||||
<span className={styles.optionText}>Download</span>
|
||||
<span className={styles.optionText}>
|
||||
{t('action.download', {
|
||||
context: 'title',
|
||||
})}
|
||||
</span>
|
||||
</button>
|
||||
{attachment.data.image && canEdit && (
|
||||
<button type="button" className={styles.option} onClick={handleToggleCoverClick}>
|
||||
|
||||
Reference in New Issue
Block a user