feat: add spinner component

This commit is contained in:
2026-11-03 16:39:13 +07:00
parent 978aecb651
commit 7399d92f36
11 changed files with 595 additions and 114 deletions
+8 -2
View File
@@ -6,6 +6,9 @@ use crate::IconRole;
/// The Segoe Fluent Icons codepoint for the role.
pub(crate) fn glyph(role: IconRole) -> Option<char> {
let codepoint = match role {
// No Segoe spinner glyph; the icon falls back to the bundled SVG,
// which the spinner rotates.
IconRole::Loader => return None,
IconRole::Check => 0xE73E, // CheckMark
IconRole::Close => 0xE8BB, // ChromeClose
IconRole::ChevronDown => 0xE70D, // ChevronDown
@@ -37,9 +40,12 @@ mod tests {
use super::*;
#[test]
fn every_role_maps_to_a_codepoint() {
fn every_role_maps_a_codepoint_or_falls_back_to_the_bundled_svg() {
for role in crate::IconRole::all() {
assert!(glyph(*role).is_some(), "missing codepoint for {role:?}");
assert!(
glyph(*role).is_some() || crate::asset_bytes(role.asset_path()).is_some(),
"no Segoe codepoint or bundled asset for {role:?}"
);
}
}