diff --git a/CodeBeam.MudBlazor.Extensions.Docs/Components/FixedTransition.razor b/CodeBeam.MudBlazor.Extensions.Docs/Components/FixedTransition.razor index 0e0ff656..f62035a5 100644 --- a/CodeBeam.MudBlazor.Extensions.Docs/Components/FixedTransition.razor +++ b/CodeBeam.MudBlazor.Extensions.Docs/Components/FixedTransition.razor @@ -4,7 +4,7 @@
@Component?.Component?.Name.Replace("`1", null) - @Component?.Description + @Component?.Description
@if (FadeIn) diff --git a/CodeBeam.MudBlazor.Extensions.Docs/Pages/Components/Barcode/BarcodePage.razor b/CodeBeam.MudBlazor.Extensions.Docs/Pages/Components/Barcode/BarcodePage.razor index 40e94cd9..11bdbbf2 100644 --- a/CodeBeam.MudBlazor.Extensions.Docs/Pages/Components/Barcode/BarcodePage.razor +++ b/CodeBeam.MudBlazor.Extensions.Docs/Pages/Components/Barcode/BarcodePage.razor @@ -9,4 +9,8 @@ + + + + diff --git a/CodeBeam.MudBlazor.Extensions.Docs/Pages/Components/Barcode/Examples/BarcodeExample2.razor b/CodeBeam.MudBlazor.Extensions.Docs/Pages/Components/Barcode/Examples/BarcodeExample2.razor new file mode 100644 index 00000000..cefa9c1a --- /dev/null +++ b/CodeBeam.MudBlazor.Extensions.Docs/Pages/Components/Barcode/Examples/BarcodeExample2.razor @@ -0,0 +1,23 @@ +@namespace MudExtensions.Docs.Examples +@using ZXing; + + + + Icon Content + + + + + + + + + Image Content + + + + + + + + diff --git a/CodeBeam.MudBlazor.Extensions.Docs/Pages/Components/Barcode/Examples/BarcodeExampleIntro.razor b/CodeBeam.MudBlazor.Extensions.Docs/Pages/Components/Barcode/Examples/BarcodeExampleIntro.razor index 2bd39565..6f78c249 100644 --- a/CodeBeam.MudBlazor.Extensions.Docs/Pages/Components/Barcode/Examples/BarcodeExampleIntro.razor +++ b/CodeBeam.MudBlazor.Extensions.Docs/Pages/Components/Barcode/Examples/BarcodeExampleIntro.razor @@ -4,4 +4,5 @@ If you feel barcode readers response slowly, increase the StrokeWidth value for a better read performance. You can independently set height and width, but for some barcode formats like QR, the component have to has same width and height (square sized). Use ForceHeight to set height for some barcode types like UPC_A and UPC_E. Remember that although you can freely specify colors, can get the best results with the highest contrast. + Always check for the barcode with centered icons. It may not work if the icon is too big. diff --git a/CodeBeam.MudBlazor.Extensions/Components/Barcode/MudBarcode.razor b/CodeBeam.MudBlazor.Extensions/Components/Barcode/MudBarcode.razor index 2624159a..99c40d4c 100644 --- a/CodeBeam.MudBlazor.Extensions/Components/Barcode/MudBarcode.razor +++ b/CodeBeam.MudBlazor.Extensions/Components/Barcode/MudBarcode.razor @@ -1,31 +1,36 @@ @namespace MudExtensions @inherits MudComponentBase - - @{ - var content = GetCode(); - } - @if (content != null) - { - var viewBoxWidth = @content.ModuleSizeX * content.Columns; - var viewBoxHeight = @content.ModuleSizeY * content.Rows; +
+ + @{ + var content = GetCode(); + } + @if (content != null) + { + var viewBoxWidth = @content.ModuleSizeX * content.Columns; + var viewBoxHeight = @content.ModuleSizeY * content.Rows; - - @for (int y = 0; y < content.Rows; y++) - { - @for (int x = 0; x < content.Columns; x++) + + @for (int y = 0; y < content.Rows; y++) { - @if (content[x, y]) + @for (int x = 0; x < content.Columns; x++) { - + @if (content[x, y]) + { + + } } } - } - - } - else - { - - } - \ No newline at end of file + + } + else + { + + } +
+ @ChildContent +
+ +
\ No newline at end of file diff --git a/CodeBeam.MudBlazor.Extensions/Components/Barcode/MudBarcode.razor.cs b/CodeBeam.MudBlazor.Extensions/Components/Barcode/MudBarcode.razor.cs index add4dcbd..7631c50a 100644 --- a/CodeBeam.MudBlazor.Extensions/Components/Barcode/MudBarcode.razor.cs +++ b/CodeBeam.MudBlazor.Extensions/Components/Barcode/MudBarcode.razor.cs @@ -1,5 +1,6 @@ using Microsoft.AspNetCore.Components; using MudBlazor; +using MudBlazor.Utilities; using ZXing; namespace MudExtensions @@ -9,6 +10,15 @@ namespace MudExtensions /// public partial class MudBarcode : MudComponentBase { + /// + /// + /// + protected string? OuterStylename => + new StyleBuilder() + .AddStyle("height", Height + "px") + .AddStyle("width", Width + "px") + .AddStyle(OuterStyle) + .Build(); private static readonly Writer Encoder = new MultiFormatWriter(); /// @@ -17,6 +27,24 @@ public partial class MudBarcode : MudComponentBase [Parameter] public BarcodeFormat BarcodeFormat { get; set; } = BarcodeFormat.QR_CODE; + /// + /// The outer div classname. + /// + [Parameter] + public string? OuterClass { get; set; } + + /// + /// The outer div classname. + /// + [Parameter] + public string? OuterStyle { get; set; } + + /// + /// The image source shows when the value is null. + /// + [Parameter] + public string? EmptySrc { get; set; } + /// /// If true, it goes to specified href when click. /// @@ -83,6 +111,12 @@ public partial class MudBarcode : MudComponentBase [Parameter] public EventCallback ValueChanged { get; set; } + /// + /// Shows a component inside the barcode. + /// + [Parameter] + public RenderFragment? ChildContent { get; set; } + /// /// Barcode process that returns BarcodeResult. Returns null if value is also null or empty. ///