mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-21 17:36:01 +00:00
using fonticon instead of span
This commit is contained in:
@@ -1,14 +1,30 @@
|
||||
import React from 'react';
|
||||
import _ from 'lodash';
|
||||
|
||||
export function ExpandIcon({ isBlank = false, isExpanded = false, className = '', ...other }) {
|
||||
if (isBlank) {
|
||||
return <span className={`mdi mdi-minus-box-outline icon-invisible ${className}`} {...other} />;
|
||||
const iconNames = {
|
||||
'icon minus-box': 'mdi mdi-minus-box-outline',
|
||||
'icon plus-box': 'mdi mdi-plus-box-outline',
|
||||
'icon invisible-box': 'mdi mdi-minus-box-outline icon-invisible',
|
||||
'icon cloud-upload': 'mdi mdi-cloud-upload',
|
||||
|
||||
'icon database': 'mdi mdi-database',
|
||||
'icon archive': 'mdi mdi-archive',
|
||||
'icon file': 'mdi mdi-file',
|
||||
};
|
||||
|
||||
export function FontIcon({ icon, className = '', ...other }) {
|
||||
if (!icon) return null;
|
||||
let cls = icon;
|
||||
if (icon.startsWith('icon ')) {
|
||||
cls = iconNames[icon];
|
||||
if (!cls) return null;
|
||||
}
|
||||
return (
|
||||
<span
|
||||
className={`${isExpanded ? 'mdi mdi-minus-box-outline' : 'mdi mdi-plus-box-outline'} ${className}`}
|
||||
{...other}
|
||||
/>
|
||||
);
|
||||
return <span className={`${cls} ${className}`} {...other} />;
|
||||
}
|
||||
|
||||
export function ExpandIcon({ isBlank = false, isExpanded = false, ...other }) {
|
||||
if (isBlank) {
|
||||
return <FontIcon icon="icon invisible-box" {...other} />;
|
||||
}
|
||||
return <FontIcon icon={isExpanded ? 'icon minus-box' : 'icon plus-box'} {...other} />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user