use crate::view::media::{Svg, svg};
macro_rules! icons {
($($variant:ident => $file:literal,)*) => {
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum IconName {
$($variant,)*
}
impl IconName {
pub fn file_name(self) -> &'static str {
match self {
$(Self::$variant => $file,)*
}
}
pub fn bytes(self) -> &'static [u8] {
match self {
$(Self::$variant => include_bytes!(concat!("svg/", $file, ".svg")),)*
}
}
}
};
}
icons! {
Aura => "aura",
ArrowDown => "arrow-down",
ArrowUp => "arrow-up",
Braces => "braces",
CaseSensitive => "case-sensitive",
Check => "check",
ChevronDown => "chevron-down",
ChevronLeft => "chevron-left",
ChevronRight => "chevron-right",
ChevronUp => "chevron-up",
Circle => "circle",
CircleAlert => "circle-alert",
Columns => "columns-2",
Command => "command",
Copy => "copy",
CornerDownLeft => "corner-down-left",
Ellipsis => "ellipsis",
File => "file",
FileCode => "file-code",
FileJson => "file-json",
FileText => "file-text",
Folder => "folder",
FolderOpen => "folder-open",
GitBranch => "git-branch",
Hash => "hash",
Image => "image",
Info => "info",
Lightbulb => "lightbulb",
List => "list",
Maximize => "maximize-2",
Minimize => "minimize-2",
Minus => "minus",
PanelBottom => "panel-bottom",
PanelLeft => "panel-left",
Pencil => "pencil",
Play => "play",
Pin => "pin",
Plus => "plus",
Regex => "regex",
Refresh => "refresh-cw",
Replace => "replace",
Save => "save",
Search => "search",
Send => "send",
Settings => "settings",
Sparkles => "sparkles",
Square => "square",
Star => "star",
Terminal => "terminal",
Trash => "trash-2",
TriangleAlert => "triangle-alert",
WholeWord => "whole-word",
Wrench => "wrench",
X => "x",
}
pub fn icon(name: IconName) -> Svg {
svg(name.file_name(), name.bytes())
}