-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
786 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using Our.Umbraco.TagHelpers.Enums; | ||
|
||
namespace Our.Umbraco.TagHelpers.Classes | ||
{ | ||
internal class OurImageSize | ||
{ | ||
public OurImageSize() { } | ||
public OurImageSize(OurScreenSize screenSize, int imageWidth, string? cropAlias = null) | ||
{ | ||
ScreenSize = screenSize; | ||
ImageWidth = imageWidth; | ||
CropAlias = cropAlias; | ||
} | ||
public OurImageSize(OurScreenSize screenSize, int imageWidth, int imageHeight) | ||
{ | ||
ScreenSize = screenSize; | ||
ImageWidth = imageWidth; | ||
ImageHeight = imageHeight; | ||
} | ||
public OurScreenSize ScreenSize { get; set; } | ||
public int ImageWidth { get; set; } | ||
public int ImageHeight { get; set; } | ||
public string? CropAlias { get; set; } | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
Our.Umbraco.TagHelpers/Configuration/OurUmbracoTagHelpersConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using Our.Umbraco.TagHelpers.Enums; | ||
|
||
namespace Our.Umbraco.TagHelpers.Configuration | ||
{ | ||
public class OurUmbracoTagHelpersConfiguration | ||
{ | ||
public ImgTagHelperConfiguration OurImg { get; set; } = new ImgTagHelperConfiguration(); | ||
} | ||
public class ImgTagHelperConfiguration | ||
{ | ||
/// <summary> | ||
/// Define the typical responsive breakpoints (S,M,L,XL,XXL) in which your website uses during screen resize | ||
/// </summary> | ||
public MediaQuerySizes MediaQueries { get; set; } = new MediaQuerySizes(); | ||
/// <summary> | ||
/// If true, let the browser handle image lazy loading, otherwise disable to use a 3rd party JavaScript based library | ||
/// </summary> | ||
public bool UseNativeLazyLoading { get; set; } = true; | ||
/// <summary> | ||
/// Applicable if UseNativeLazyLoading is false | ||
/// </summary> | ||
public string LazyLoadCssClass { get; set; } = "lazyload"; | ||
/// <summary> | ||
/// Applicable if UseNativeLazyLoading is false | ||
/// </summary> | ||
public ImagePlaceholderType LazyLoadPlaceholder { get; set; } = ImagePlaceholderType.SVG; | ||
/// <summary> | ||
/// Applicable if UseNativeLazyLoading is false & LazyLoadPlaceholder is LowQualityImage | ||
/// </summary> | ||
public int LazyLoadPlaceholderLowQualityImageQuality { get; set; } = 5; | ||
public bool ApplyAspectRatio { get; set; } = false; | ||
public bool MobileFirst { get; set; } = true; | ||
|
||
/// <summary> | ||
/// The property alias of the media type containing the alternative text value. | ||
/// </summary> | ||
public string AlternativeTextMediaTypePropertyAlias { get; set; } = "alternativeText"; | ||
} | ||
public class MediaQuerySizes | ||
{ | ||
public int Small { get; set; } = 576; | ||
public int Medium { get; set; } = 768; | ||
public int Large { get; set; } = 992; | ||
public int ExtraLarge { get; set; } = 1200; | ||
public int ExtraExtraLarge { get; set; } = 1400; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
Our.Umbraco.TagHelpers/Configuration/OurUmbracoTagHelpersConfigurationComposer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Our.Umbraco.TagHelpers.Services; | ||
using Umbraco.Cms.Core.Composing; | ||
using Umbraco.Cms.Core.DependencyInjection; | ||
|
||
namespace Our.Umbraco.TagHelpers.Configuration | ||
{ | ||
public class OurUmbracoTagHelpersConfigurationComposer : IComposer | ||
{ | ||
public void Compose(IUmbracoBuilder builder) | ||
{ | ||
builder.Services.AddOptions<OurUmbracoTagHelpersConfiguration>() | ||
.Bind(builder.Config.GetSection("Our.Umbraco.TagHelpers")); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Our.Umbraco.TagHelpers.Enums | ||
{ | ||
public enum ImagePlaceholderType | ||
{ | ||
SVG, | ||
LowQualityImage | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Our.Umbraco.TagHelpers.Enums | ||
{ | ||
public enum OurScreenSize | ||
{ | ||
Small = 100, | ||
Medium = 200, | ||
Large = 300, | ||
ExtraLarge = 400, | ||
ExtraExtraLarge = 500 | ||
} | ||
} |
Oops, something went wrong.