Skip to content

Commit

Permalink
feat(blazor): move Icon to core descriptor, make it string
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 857c85d commit 9b16f52
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/Sitko.Blockly.Blazor/BlazorBlockDescriptor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ protected BlazorBlockDescriptor(ILocalizationProvider<TBlock> localizationProvid
{
}

public abstract RenderFragment Icon { get; }
public virtual Type FormComponent => typeof(TFormComponent);
public virtual Type DisplayComponent => typeof(TDisplayComponent);
}
1 change: 0 additions & 1 deletion src/Sitko.Blockly.Blazor/IBlazorBlockDescriptor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ public interface IBlazorBlockDescriptor : IBlockDescriptor
{
string DisplayComponentCssClass => "";
string FormComponentCssClass => "";
RenderFragment Icon { get; }
Type FormComponent { get; }
Type DisplayComponent { get; }
}
Expand Down
3 changes: 3 additions & 0 deletions src/Sitko.Blockly/BlockDescriptor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public interface IBlockDescriptor
string Title { get; }
Type Type { get; }
string Key { get; }
string Icon { get; }
}

// ReSharper disable once UnusedTypeParameter
Expand All @@ -19,6 +20,7 @@ public abstract record BlockDescriptor : IBlockDescriptor
public abstract string Title { get; }
public abstract Type Type { get; }
public abstract string Key { get; }
public abstract string Icon { get; }
}

public abstract record BlockDescriptor<TBlock> : BlockDescriptor, IBlockDescriptor<TBlock>
Expand All @@ -33,4 +35,5 @@ public BlockDescriptor(ILocalizationProvider<TBlock> localizationProvider) =>

public override string Title => LocalizationProvider[typeof(TBlock).Name];
public override string Key => typeof(TBlock).Name.Replace("Block", "").ToLowerInvariant();
public override string Icon => "";
}
4 changes: 2 additions & 2 deletions src/Sitko.Blockly/Blocks/CutBlock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ public record CutBlock : ContentBlock
public override bool ShouldRender(BlocklyListOptions listOptions) =>
listOptions.Mode == BlocksListMode.Preview;

public override bool ShouldRenderNext(BlocklyListOptions options) =>
options.Mode == BlocksListMode.Full;
public override bool ShouldRenderNext(BlocklyListOptions listOptions) =>
listOptions.Mode == BlocksListMode.Full;
}

public record CutBlockDescriptor : BlockDescriptor<CutBlock>
Expand Down
1 change: 1 addition & 0 deletions src/Sitko.Blockly/ContentBlockMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public ContentBlockMetadata(Type blockType, int priority = int.MaxValue, int max
public Type BlockType { get; }
}

[AttributeUsage(AttributeTargets.Class)]
public class ContentBlockMetadataAttribute : Attribute
{
public ContentBlockMetadataAttribute(int priority = int.MaxValue, int maxCount = 0)
Expand Down

0 comments on commit 9b16f52

Please sign in to comment.