diff --git a/packages/ui/src/components/file-icon.css b/packages/ui/src/components/file-icon.css index a49674a90..5776425de 100644 --- a/packages/ui/src/components/file-icon.css +++ b/packages/ui/src/components/file-icon.css @@ -1,4 +1,5 @@ [data-component="file-icon"] { + display: block; flex-shrink: 0; width: 16px; height: 16px; diff --git a/packages/ui/src/components/file-icon.tsx b/packages/ui/src/components/file-icon.tsx index 405cbe163..133cb169c 100644 --- a/packages/ui/src/components/file-icon.tsx +++ b/packages/ui/src/components/file-icon.tsx @@ -1,10 +1,8 @@ import type { Component, JSX } from "solid-js" -import { createMemo, splitProps, Show } from "solid-js" +import { createMemo, createUniqueId, splitProps, Show } from "solid-js" import sprite from "./file-icons/sprite.svg" import type { IconName } from "./file-icons/types" -let filter = 0 - export type FileIconProps = JSX.GSVGAttributes & { node: { path: string; type: "file" | "directory" } expanded?: boolean @@ -14,7 +12,7 @@ export type FileIconProps = JSX.GSVGAttributes & { export const FileIcon: Component = (props) => { const [local, rest] = splitProps(props, ["node", "class", "classList", "expanded", "mono"]) const name = createMemo(() => chooseIconName(local.node.path, local.node.type, local.expanded || false)) - const id = `file-icon-mono-${filter++}` + const id = `file-icon-mono-${createUniqueId()}` return ( = (props) => { [local.class ?? ""]: !!local.class, }} > - + }> - - - - + + + + - ) }