Skip to content

Commit 93ea93d

Browse files
committed
refactor: add icon component
1 parent 14d5a86 commit 93ea93d

File tree

2 files changed

+80
-1
lines changed

2 files changed

+80
-1
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<svg @attributes="@AdditionalAttributes" class="fill-lochmara dark:fill-lochmara" viewBox="@($"0 0 {(int) Value.Size} {(int) Value.Size}")" width="@((int) Value.Size)">
2+
@((MarkupString) Value.Content)
3+
</svg>
4+
5+
@code {
6+
7+
[Parameter(CaptureUnmatchedValues = true)] public IDictionary<string, object>? AdditionalAttributes { get; set; }
8+
9+
[EditorRequired, Parameter] public Icon Value { get; set; } = null!;
10+
11+
public class Icon(string name, string content, IconVariant variant, IconSize size)
12+
{
13+
public string Name { get; set; } = name;
14+
15+
public string Content { get; set; } = content;
16+
17+
public IconVariant Variant { get; set; } = variant;
18+
19+
public IconSize Size { get; set; } = size;
20+
}
21+
22+
/// <summary>
23+
/// Describes the variant of an <see cref="AzureIcon"/>.
24+
/// </summary>
25+
public enum IconVariant
26+
{
27+
/// <summary>
28+
/// The regular variant.
29+
/// </summary>
30+
Regular
31+
}
32+
33+
/// <summary>
34+
/// Describes the size of an <see cref="AzureIcon"/>.
35+
/// </summary>
36+
public enum IconSize
37+
{
38+
/// <summary>
39+
/// The size 10x10.
40+
/// </summary>
41+
Size10 = 10,
42+
43+
/// <summary>
44+
/// The size 12x12.
45+
/// </summary>
46+
Size12 = 12,
47+
48+
/// <summary>
49+
/// The size 16x16.
50+
/// </summary>
51+
Size16 = 16,
52+
53+
/// <summary>
54+
/// The size 20x20.
55+
/// </summary>
56+
Size20 = 20,
57+
58+
/// <summary>
59+
/// The size 24x24.
60+
/// </summary>
61+
Size24 = 24,
62+
63+
/// <summary>
64+
/// The size 28x28.
65+
/// </summary>
66+
Size28 = 28,
67+
68+
/// <summary>
69+
/// The size 32x32.
70+
/// </summary>
71+
Size32 = 32,
72+
73+
/// <summary>
74+
/// The size 48x48.
75+
/// </summary>
76+
Size48 = 48
77+
}
78+
79+
}

0 commit comments

Comments
 (0)