Skip to content

Commit

Permalink
feat(antdesign): use new string icons
Browse files Browse the repository at this point in the history
Refs: BLOCKLY-T-2
  • Loading branch information
SonicGD committed Jan 19, 2022
1 parent 9b16f52 commit 0092c2d
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 13 deletions.
5 changes: 2 additions & 3 deletions src/Sitko.Blockly.AntDesign/Blocks/AntCutBlockDescriptor.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Microsoft.AspNetCore.Components;
using Sitko.Blockly.AntDesignComponents.Display.Blocks;
using Sitko.Blockly.AntDesignComponents.Display.Blocks;
using Sitko.Blockly.AntDesignComponents.Forms.Blocks;
using Sitko.Blockly.Blazor;
using Sitko.Blockly.Blocks;
Expand All @@ -13,5 +12,5 @@ public AntCutBlockDescriptor(ILocalizationProvider<CutBlock> localizationProvide
{
}

public override RenderFragment Icon => builder => builder.AddIcon("cut");
public override string Icon => "cut";
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ public AntFilesBlockDescriptor(ILocalizationProvider<FilesBlock> localizationPro
{
}

public override RenderFragment Icon => builder => builder.AddIcon("attach");
public override string Icon => "attach";
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ public AntGalleryBlockDescriptor(ILocalizationProvider<GalleryBlock> localizatio
{
}

public override RenderFragment Icon => builder => builder.AddIcon("gallery");
public override string Icon => "gallery";
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ public AntIframeBlockDescriptor(ILocalizationProvider<IframeBlock> localizationP
{
}

public override RenderFragment Icon => builder => builder.AddIcon("embed");
public override string Icon => "embed";
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ public AntQuoteBlockDescriptor(ILocalizationProvider<QuoteBlock> localizationPro
{
}

public override RenderFragment Icon => builder => builder.AddIcon("quote");
public override string Icon => "quote";
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ public AntTextBlockDescriptor(ILocalizationProvider<TextBlock> localizationProvi
{
}

public override RenderFragment Icon => builder => builder.AddIcon("text");
public override string Icon => "text";
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ public AntTwitchBlockDescriptor(ILocalizationProvider<TwitchBlock> localizationP
{
}

public override RenderFragment Icon => builder => builder.AddIcon("twitch");
public override string Icon => "twitch";
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ public AntTwitterBlockDescriptor(ILocalizationProvider<TwitterBlock> localizatio
{
}

public override RenderFragment Icon => builder => builder.AddIcon("twitter");
public override string Icon => "twitter";
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ public AntYoutubeBlockDescriptor(ILocalizationProvider<YoutubeBlock> localizatio
{
}

public override RenderFragment Icon => builder => builder.AddIcon("youtube");
public override string Icon => "youtube";
}
4 changes: 2 additions & 2 deletions src/Sitko.Blockly.AntDesign/Forms/AntBlocklyForm.razor
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</div>
<div class="block-controls block-controls-default">
<div class="block-mainicon" title="@blockDescriptor.Title">
@blockDescriptor.Icon
<CustomAntIcon Icon="@blockDescriptor.Icon"></CustomAntIcon>
</div>
<span title="@(block.Enabled ? LocalizationProvider["Disable block"] : LocalizationProvider["Enable block"])">
<AntDesign.Button Size="Default" OnClick="@(() => block.Enabled = !block.Enabled)" Class="block-disable-button">
Expand Down Expand Up @@ -77,7 +77,7 @@
foreach (var descriptor in BlockDescriptors)
{
<span class="add-block-button" title="@descriptor.Title">
<AntDesign.Button Disabled="!CanAdd(descriptor)" Size="@AntSizeLDSType.Default" OnClick="() => AddBlock(descriptor, afterBlock)">@descriptor.Icon</AntDesign.Button>
<AntDesign.Button Disabled="!CanAdd(descriptor)" Size="@AntSizeLDSType.Default" OnClick="() => AddBlock(descriptor, afterBlock)"><CustomAntIcon Icon="@descriptor.Icon"></CustomAntIcon></AntDesign.Button>
</span>
}
}
Expand Down
15 changes: 15 additions & 0 deletions src/Sitko.Blockly.AntDesign/Icons/CustomAntIcon.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@if (!string.IsNullOrEmpty(Icon))
{
<Icon>
<Component>
@CustomIconsProvider.GetIcon(Icon)
</Component>
</Icon>
}

@code {

[Parameter]
public string Icon { get; set; } = "";

}
1 change: 1 addition & 0 deletions src/Sitko.Blockly.AntDesign/_Imports.razor
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@
@using Sitko.Blockly.Blazor.Forms.Blocks
@using Sitko.Blockly.Blazor.Display
@using Sitko.Blockly.Blazor.Display.Blocks
@using Sitko.Blockly.AntDesignComponents.Icons
@using Sitko.Blazor.CKEditor

0 comments on commit 0092c2d

Please sign in to comment.