show placeholder when favicon is loading

This commit is contained in:
Athou
2022-11-08 11:51:26 +01:00
parent 9e65f5726c
commit 9466bc544c
6 changed files with 40 additions and 15 deletions

View File

@@ -1,4 +1,5 @@
import { Box, createStyles, Image } from "@mantine/core"
import { Box, createStyles } from "@mantine/core"
import { FeedFavicon } from "components/content/FeedFavicon"
import React, { ReactNode } from "react"
import { UnreadCount } from "./UnreadCount"
@@ -49,11 +50,7 @@ export function TreeNode(props: TreeNodeProps) {
return (
<Box py={1} pl={props.level * 20} className={classes.node} onClick={(e: React.MouseEvent) => props.onClick(e, props.id)}>
<Box mr={6} onClick={(e: React.MouseEvent) => props.onIconClick && props.onIconClick(e, props.id)}>
{typeof props.icon === "string" ? (
<Image withPlaceholder src={props.icon} alt="favicon" width={18} height={18} />
) : (
props.icon
)}
{typeof props.icon === "string" ? <FeedFavicon url={props.icon} /> : props.icon}
</Box>
<Box className={classes.nodeText}>{props.name}</Box>
{!props.expanded && (