一些检查失败了
automerge / automerge (push) Has been cancelled
react-native-android-build-apk / AssembleRelease (push) Has been cancelled
Build macOS M1 / Main (push) Has been cancelled
Joplin Continuous Integration / Main (macos-15-intel) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-11-vs2026-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-2025) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04-arm) (push) Has been cancelled
Joplin UI tests / Main (ubuntu-22.04) (push) Has been cancelled
Joplin UI tests / Main (windows-2025) (push) Has been cancelled
Joplin UI tests / Mobile (push) Has been cancelled
Close stale issues / ProcessStaleIssues (push) Has been cancelled
26 行
917 B
TypeScript
26 行
917 B
TypeScript
import * as React from 'react';
|
|
import { FolderIcon, FolderIconType } from '@joplin/lib/services/database/types';
|
|
import EmojiBox from './EmojiBox';
|
|
|
|
interface Props {
|
|
folderIcon: FolderIcon;
|
|
opacity?: number;
|
|
}
|
|
|
|
export default function(props: Props) {
|
|
const folderIcon = props.folderIcon;
|
|
const opacity = 'opacity' in props ? props.opacity : 1;
|
|
const width = 20;
|
|
const height = 20;
|
|
|
|
if (folderIcon.type === FolderIconType.Emoji) {
|
|
return <EmojiBox width={width} height={height} emoji={folderIcon.emoji}/>;
|
|
} else if (folderIcon.type === FolderIconType.DataUrl) {
|
|
return <img style={{ width, height, opacity }} src={folderIcon.dataUrl} />;
|
|
} else if (folderIcon.type === FolderIconType.FontAwesome) {
|
|
return <i style={{ fontSize: 18, width, opacity }} className={folderIcon.name} role='img' aria-hidden={true}></i>;
|
|
} else {
|
|
throw new Error(`Unsupported folder icon type: ${folderIcon.type}`);
|
|
}
|
|
}
|