fix: address PR review feedback for icon migration
- Use AlertCircle for error and AlertTriangle for warning icons - Use Icon color prop instead of CSS fill for Lucide stroke-based icons - Replace wildcard import with explicit named imports for tree-shaking - Replace sx prop with style prop on Icon components - Add Trash2 to Icon component imports
This commit is contained in:
1 parent
7140d436a5
commit
7874439e4c
6 files changed
+144
-18
No files matched your search
@@ -18,7 +18,7 @@ const icons = {
|
|||||||
),
|
),
|
||||||
error: (
|
error: (
|
||||||
<Icon
|
<Icon
|
||||||
name="AlertTriangle"
|
name="AlertCircle"
|
||||||
size={24}
|
size={24}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -39,17 +39,11 @@ const Check = ({ text, noHighlightText, variant = "info", outlined = false }) =>
|
|||||||
size={20}
|
size={20}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<Box
|
<Icon
|
||||||
lineHeight={0}
|
name="Check"
|
||||||
sx={{
|
size={16}
|
||||||
"& svg > path": { fill: colors[variant] },
|
color={colors[variant]}
|
||||||
}}
|
/>
|
||||||
>
|
|
||||||
<Icon
|
|
||||||
name="Check"
|
|
||||||
size={16}
|
|
||||||
/>
|
|
||||||
</Box>
|
|
||||||
)}
|
)}
|
||||||
<Typography
|
<Typography
|
||||||
component="span"
|
component="span"
|
||||||
|
|||||||
@@ -1,6 +1,138 @@
|
|||||||
import { useTheme } from "@mui/material";
|
import { useTheme } from "@mui/material";
|
||||||
import * as LucideIcons from "lucide-react";
|
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
|
import {
|
||||||
|
Activity,
|
||||||
|
AlertCircle,
|
||||||
|
AlertTriangle,
|
||||||
|
ArrowDown,
|
||||||
|
ArrowLeft,
|
||||||
|
ArrowUp,
|
||||||
|
ArrowUpRight,
|
||||||
|
Bell,
|
||||||
|
Calendar,
|
||||||
|
Check,
|
||||||
|
CheckCircle,
|
||||||
|
CheckSquare,
|
||||||
|
ChevronDown,
|
||||||
|
ChevronLeft,
|
||||||
|
ChevronRight,
|
||||||
|
ChevronsLeft,
|
||||||
|
ChevronsRight,
|
||||||
|
ChevronsUpDown,
|
||||||
|
Circle,
|
||||||
|
CircleDot,
|
||||||
|
Clock,
|
||||||
|
Code,
|
||||||
|
Cpu,
|
||||||
|
Database,
|
||||||
|
ExternalLink,
|
||||||
|
Eye,
|
||||||
|
EyeOff,
|
||||||
|
FileText,
|
||||||
|
Gauge,
|
||||||
|
Globe,
|
||||||
|
GripVertical,
|
||||||
|
HelpCircle,
|
||||||
|
History,
|
||||||
|
Image,
|
||||||
|
Info,
|
||||||
|
Key,
|
||||||
|
Layers,
|
||||||
|
Link,
|
||||||
|
Lock,
|
||||||
|
LogOut,
|
||||||
|
Mail,
|
||||||
|
Menu,
|
||||||
|
MessageCircle,
|
||||||
|
MoreVertical,
|
||||||
|
Pause,
|
||||||
|
PauseCircle,
|
||||||
|
Play,
|
||||||
|
PlayCircle,
|
||||||
|
PlusCircle,
|
||||||
|
RefreshCw,
|
||||||
|
Ruler,
|
||||||
|
Search,
|
||||||
|
Settings,
|
||||||
|
Square,
|
||||||
|
Trash2,
|
||||||
|
TrendingUp,
|
||||||
|
Upload,
|
||||||
|
User,
|
||||||
|
Users,
|
||||||
|
Wifi,
|
||||||
|
Wrench,
|
||||||
|
X,
|
||||||
|
} from "lucide-react";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Map of icon names to Lucide icon components.
|
||||||
|
* Only includes icons that are actually used in the application.
|
||||||
|
*/
|
||||||
|
const iconComponents = {
|
||||||
|
Activity,
|
||||||
|
AlertCircle,
|
||||||
|
AlertTriangle,
|
||||||
|
ArrowDown,
|
||||||
|
ArrowLeft,
|
||||||
|
ArrowUp,
|
||||||
|
ArrowUpRight,
|
||||||
|
Bell,
|
||||||
|
Calendar,
|
||||||
|
Check,
|
||||||
|
CheckCircle,
|
||||||
|
CheckSquare,
|
||||||
|
ChevronDown,
|
||||||
|
ChevronLeft,
|
||||||
|
ChevronRight,
|
||||||
|
ChevronsLeft,
|
||||||
|
ChevronsRight,
|
||||||
|
ChevronsUpDown,
|
||||||
|
Circle,
|
||||||
|
CircleDot,
|
||||||
|
Clock,
|
||||||
|
Code,
|
||||||
|
Cpu,
|
||||||
|
Database,
|
||||||
|
ExternalLink,
|
||||||
|
Eye,
|
||||||
|
EyeOff,
|
||||||
|
FileText,
|
||||||
|
Gauge,
|
||||||
|
Globe,
|
||||||
|
GripVertical,
|
||||||
|
HelpCircle,
|
||||||
|
History,
|
||||||
|
Image,
|
||||||
|
Info,
|
||||||
|
Key,
|
||||||
|
Layers,
|
||||||
|
Link,
|
||||||
|
Lock,
|
||||||
|
LogOut,
|
||||||
|
Mail,
|
||||||
|
Menu,
|
||||||
|
MessageCircle,
|
||||||
|
MoreVertical,
|
||||||
|
Pause,
|
||||||
|
PauseCircle,
|
||||||
|
Play,
|
||||||
|
PlayCircle,
|
||||||
|
PlusCircle,
|
||||||
|
RefreshCw,
|
||||||
|
Ruler,
|
||||||
|
Search,
|
||||||
|
Settings,
|
||||||
|
Square,
|
||||||
|
Trash2,
|
||||||
|
TrendingUp,
|
||||||
|
Upload,
|
||||||
|
User,
|
||||||
|
Users,
|
||||||
|
Wifi,
|
||||||
|
Wrench,
|
||||||
|
X,
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Theme-aware icon component wrapping Lucide icons
|
* Theme-aware icon component wrapping Lucide icons
|
||||||
@@ -34,10 +166,10 @@ const Icon = ({ name, size = 20, color, strokeWidth = 1.5, fill = "none", ...pro
|
|||||||
return colorValue;
|
return colorValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
const LucideIcon = LucideIcons[name];
|
const LucideIcon = iconComponents[name];
|
||||||
|
|
||||||
if (!LucideIcon) {
|
if (!LucideIcon) {
|
||||||
console.warn(`Icon "${name}" not found in Lucide icons`);
|
console.warn(`Icon "${name}" not found in Icon component`);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ const icons = {
|
|||||||
),
|
),
|
||||||
error: (
|
error: (
|
||||||
<Icon
|
<Icon
|
||||||
name="AlertTriangle"
|
name="AlertCircle"
|
||||||
size={24}
|
size={24}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ const MonitorListItem = ({ monitor, onDelete }) => {
|
|||||||
<Icon
|
<Icon
|
||||||
name="Trash2"
|
name="Trash2"
|
||||||
size={20}
|
size={20}
|
||||||
sx={{ cursor: "pointer" }}
|
style={{ cursor: "pointer" }}
|
||||||
onClick={() => onDelete(monitor)}
|
onClick={() => onDelete(monitor)}
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ const MonitorListItem = ({
|
|||||||
<Icon
|
<Icon
|
||||||
name="Trash2"
|
name="Trash2"
|
||||||
size={20}
|
size={20}
|
||||||
sx={{ marginLeft: "auto" }}
|
style={{ marginLeft: "auto", cursor: "pointer" }}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
onDelete(monitor);
|
onDelete(monitor);
|
||||||
}}
|
}}
|
||||||
|
|||||||
Reference in new issue
Block a user