mirror of
https://github.com/pawelmalak/flame.git
synced 2024-12-20 08:41:48 +03:00
commit
c1b61f9cd9
@ -43,3 +43,10 @@
|
||||
margin-left: 2px;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
.CustomIcon {
|
||||
width: 90%;
|
||||
height: 90%;
|
||||
margin-top: 2px;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ import classes from './BookmarkCard.module.css';
|
||||
|
||||
import Icon from '../../UI/Icons/Icon/Icon';
|
||||
import { iconParser, urlParser, searchConfig } from '../../../utility';
|
||||
import { Fragment } from 'react';
|
||||
|
||||
interface ComponentProps {
|
||||
category: Category;
|
||||
@ -16,7 +17,9 @@ const BookmarkCard = (props: ComponentProps): JSX.Element => {
|
||||
{props.category.bookmarks.map((bookmark: Bookmark) => {
|
||||
const redirectUrl = urlParser(bookmark.url)[1];
|
||||
|
||||
let iconEl: JSX.Element;
|
||||
let iconEl: JSX.Element = <Fragment></Fragment>;
|
||||
|
||||
if (bookmark.icon) {
|
||||
const { icon, name } = bookmark;
|
||||
|
||||
if (/.(jpeg|jpg|png)$/i.test(icon)) {
|
||||
@ -34,7 +37,7 @@ const BookmarkCard = (props: ComponentProps): JSX.Element => {
|
||||
<div className={classes.BookmarkIcon}>
|
||||
<svg
|
||||
data-src={`/uploads/${icon}`}
|
||||
fill='var(--color-primary)'
|
||||
fill="var(--color-primary)"
|
||||
className={classes.BookmarkIconSvg}
|
||||
></svg>
|
||||
</div>
|
||||
@ -46,15 +49,16 @@ const BookmarkCard = (props: ComponentProps): JSX.Element => {
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<a
|
||||
href={redirectUrl}
|
||||
target={searchConfig('bookmarksSameTab', false) ? '' : '_blank'}
|
||||
rel='noreferrer'
|
||||
rel="noreferrer"
|
||||
key={`bookmark-${bookmark.id}`}
|
||||
>
|
||||
{icon && iconEl}
|
||||
{bookmark.icon && iconEl}
|
||||
{bookmark.name}
|
||||
</a>
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user