mirror of
https://github.com/pawelmalak/flame.git
synced 2025-07-23 05:19:37 +02:00
Bookmark icon fixes
This commit is contained in:
parent
36c9b7648a
commit
78a018f686
2 changed files with 41 additions and 30 deletions
|
@ -43,3 +43,10 @@
|
||||||
margin-left: 2px;
|
margin-left: 2px;
|
||||||
object-fit: contain;
|
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 Icon from '../../UI/Icons/Icon/Icon';
|
||||||
import { iconParser, urlParser, searchConfig } from '../../../utility';
|
import { iconParser, urlParser, searchConfig } from '../../../utility';
|
||||||
|
import { Fragment } from 'react';
|
||||||
|
|
||||||
interface ComponentProps {
|
interface ComponentProps {
|
||||||
category: Category;
|
category: Category;
|
||||||
|
@ -16,7 +17,9 @@ const BookmarkCard = (props: ComponentProps): JSX.Element => {
|
||||||
{props.category.bookmarks.map((bookmark: Bookmark) => {
|
{props.category.bookmarks.map((bookmark: Bookmark) => {
|
||||||
const redirectUrl = urlParser(bookmark.url)[1];
|
const redirectUrl = urlParser(bookmark.url)[1];
|
||||||
|
|
||||||
let iconEl: JSX.Element;
|
let iconEl: JSX.Element = <Fragment></Fragment>;
|
||||||
|
|
||||||
|
if (bookmark.icon) {
|
||||||
const { icon, name } = bookmark;
|
const { icon, name } = bookmark;
|
||||||
|
|
||||||
if (/.(jpeg|jpg|png)$/i.test(icon)) {
|
if (/.(jpeg|jpg|png)$/i.test(icon)) {
|
||||||
|
@ -34,7 +37,7 @@ const BookmarkCard = (props: ComponentProps): JSX.Element => {
|
||||||
<div className={classes.BookmarkIcon}>
|
<div className={classes.BookmarkIcon}>
|
||||||
<svg
|
<svg
|
||||||
data-src={`/uploads/${icon}`}
|
data-src={`/uploads/${icon}`}
|
||||||
fill='var(--color-primary)'
|
fill="var(--color-primary)"
|
||||||
className={classes.BookmarkIconSvg}
|
className={classes.BookmarkIconSvg}
|
||||||
></svg>
|
></svg>
|
||||||
</div>
|
</div>
|
||||||
|
@ -46,15 +49,16 @@ const BookmarkCard = (props: ComponentProps): JSX.Element => {
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<a
|
<a
|
||||||
href={redirectUrl}
|
href={redirectUrl}
|
||||||
target={searchConfig('bookmarksSameTab', false) ? '' : '_blank'}
|
target={searchConfig('bookmarksSameTab', false) ? '' : '_blank'}
|
||||||
rel='noreferrer'
|
rel="noreferrer"
|
||||||
key={`bookmark-${bookmark.id}`}
|
key={`bookmark-${bookmark.id}`}
|
||||||
>
|
>
|
||||||
{icon && iconEl}
|
{bookmark.icon && iconEl}
|
||||||
{bookmark.name}
|
{bookmark.name}
|
||||||
</a>
|
</a>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue