Skip to content

Commit 42a9ed4

Browse files
authored
Merge pull request #26 from Geta/feature-fa7
Add support for FontAwesome 7.2.0
2 parents f8259f8 + 5d62637 commit 42a9ed4

17 files changed

Lines changed: 15466 additions & 6 deletions

File tree

src/Geta.Optimizely.ContentTypeIcons.EnumGenerator/Program.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.IO;
44
using System.IO.Compression;
@@ -49,7 +49,7 @@ static async Task Main()
4949
foreach (var item in styles)
5050
{
5151
var styleName = item.ToTitleCase();
52-
var enumName = $"FontAwesome5{styleName}";
52+
var enumName = $"FontAwesome7{styleName}";
5353
var localPath = $@"{enumBasePath}\{enumName}.cs";
5454

5555
Console.WriteLine("\nGenerating {0}.cs...", enumName);
@@ -67,7 +67,9 @@ static async Task Main()
6767

6868
private static void CopyFontFiles(ZipArchive archive, string enumBasePath)
6969
{
70-
var destination = $@"{enumBasePath}\module\ClientResources\fa5\webfonts\";
70+
var destination = $@"{enumBasePath}\module\ClientResources\fa7\webfonts\";
71+
Directory.CreateDirectory(destination);
72+
7173
var rootEntry = archive.Entries[0];
7274
var fontEntries = archive.Entries.Where(x =>
7375
x.FullName.StartsWith(rootEntry + "webfonts") &&
@@ -82,7 +84,9 @@ private static void CopyFontFiles(ZipArchive archive, string enumBasePath)
8284

8385
private static void CopyCssFiles(ZipArchive archive, string enumBasePath)
8486
{
85-
var destination = $@"{enumBasePath}\module\ClientResources\fa5\css\";
87+
var destination = $@"{enumBasePath}\module\ClientResources\fa7\css\";
88+
Directory.CreateDirectory(destination);
89+
8690
var rootEntry = archive.Entries[0];
8791
var cssFile = archive.Entries.Single(x => x.FullName.Contains(rootEntry + "css/all.min.css"));
8892

src/Geta.Optimizely.ContentTypeIcons/Attributes/ContentTypeIconAttribute.cs

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using EPiServer.DataAnnotations;
33

44
namespace Geta.Optimizely.ContentTypeIcons.Attributes
@@ -111,6 +111,74 @@ public ContentTypeIconAttribute(
111111
FontSize = fontSize;
112112
}
113113

114+
/// <summary>
115+
/// Initializes a new instance of the <see cref="T:Geta.Optimizely.ContentTypeIcons.Attributes.ContentTypeIconAttribute" /> class.
116+
/// </summary>
117+
/// <param name="icon">The FontAwesome7Brands icon to be used</param>
118+
/// <param name="rotate">The rotation to be used, defaults to None</param>
119+
/// <param name="backgroundColor">The backgroundColor to be used when rendering the image (specified in hexadecimal, for example #000000)</param>
120+
/// <param name="foregroundColor">The foregroundColor to be used when rendering the image (specified in hexadecimal, for example #ffffff) </param>
121+
/// <param name="fontSize">The fontSize to be used, default value is 40</param>
122+
public ContentTypeIconAttribute(
123+
FontAwesome7Brands icon,
124+
Rotations rotate = Rotations.None,
125+
string backgroundColor = "",
126+
string foregroundColor = "",
127+
int fontSize = -1)
128+
: base(string.Empty)
129+
{
130+
Icon = icon;
131+
Rotate = rotate;
132+
BackgroundColor = backgroundColor;
133+
ForegroundColor = foregroundColor;
134+
FontSize = fontSize;
135+
}
136+
137+
/// <summary>
138+
/// Initializes a new instance of the <see cref="T:Geta.Optimizely.ContentTypeIcons.Attributes.ContentTypeIconAttribute" /> class.
139+
/// </summary>
140+
/// <param name="icon">The FontAwesome7Regular icon to be used</param>
141+
/// <param name="rotate">The rotation to be used, defaults to None</param>
142+
/// <param name="backgroundColor">The backgroundColor to be used when rendering the image (specified in hexadecimal, for example #000000)</param>
143+
/// <param name="foregroundColor">The foregroundColor to be used when rendering the image (specified in hexadecimal, for example #ffffff) </param>
144+
/// <param name="fontSize">The fontSize to be used, default value is 40</param>
145+
public ContentTypeIconAttribute(
146+
FontAwesome7Regular icon,
147+
Rotations rotate = Rotations.None,
148+
string backgroundColor = "",
149+
string foregroundColor = "",
150+
int fontSize = -1)
151+
: base(string.Empty)
152+
{
153+
Icon = icon;
154+
Rotate = rotate;
155+
BackgroundColor = backgroundColor;
156+
ForegroundColor = foregroundColor;
157+
FontSize = fontSize;
158+
}
159+
160+
/// <summary>
161+
/// Initializes a new instance of the <see cref="T:Geta.Optimizely.ContentTypeIcons.Attributes.ContentTypeIconAttribute" /> class.
162+
/// </summary>
163+
/// <param name="icon">The FontAwesome7Solid icon to be used</param>
164+
/// <param name="rotate">The rotation to be used, defaults to None</param>
165+
/// <param name="backgroundColor">The backgroundColor to be used when rendering the image (specified in hexadecimal, for example #000000)</param>
166+
/// <param name="foregroundColor">The foregroundColor to be used when rendering the image (specified in hexadecimal, for example #ffffff) </param>
167+
/// <param name="fontSize">The fontSize to be used, default value is 40</param>
168+
public ContentTypeIconAttribute(
169+
FontAwesome7Solid icon,
170+
Rotations rotate = Rotations.None,
171+
string backgroundColor = "",
172+
string foregroundColor = "",
173+
int fontSize = -1)
174+
: base(string.Empty)
175+
{
176+
Icon = icon;
177+
Rotate = rotate;
178+
BackgroundColor = backgroundColor;
179+
ForegroundColor = foregroundColor;
180+
FontSize = fontSize;
181+
}
114182

115183
/// <summary>
116184
/// Initializes a new instance of the <see cref="T:Geta.Optimizely.ContentTypeIcons.Attributes.ContentTypeIconAttribute" /> class.

0 commit comments

Comments
 (0)