bye svelte; welcome solid
This commit is contained in:
parent
97cf350a32
commit
2fe6f6fc37
21 changed files with 686 additions and 569 deletions
24
src/settings/Icon.tsx
Normal file
24
src/settings/Icon.tsx
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import { onMount, Show } from 'solid-js';
|
||||
import { setIcon } from 'obsidian';
|
||||
|
||||
interface IconProps {
|
||||
iconName?: string;
|
||||
}
|
||||
|
||||
export default function Icon(props: IconProps) {
|
||||
let iconEl: HTMLDivElement | undefined;
|
||||
|
||||
onMount(() => {
|
||||
if (iconEl) {
|
||||
setIcon(iconEl, props.iconName || '');
|
||||
}
|
||||
});
|
||||
|
||||
return (
|
||||
<Show when={(props.iconName || '').length > 0}>
|
||||
<div class="icon-wrapper">
|
||||
<div ref={iconEl} class="icon"></div>
|
||||
</div>
|
||||
</Show>
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue