Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions examples/Demo/Shared/Components/ApiDocumentation.razor
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
@* Display list of Enumerations (if available) *@
@if (context.EnumValues.Length > 0)
{

var id = Identifier.NewId();
<span id="@id">
<FluentIcon Value="@(new Icons.Regular.Size20.Info())" Style="margin-left: 10px; vertical-align: top;" Color="@Color.Accent" />
Expand All @@ -46,10 +45,29 @@
@item <br />
}
</FluentTooltip>
}
</TemplateColumn>

<TemplateColumn Title="Default">
@if (context.Icon != null)
{
var id = Identifier.NewId();
<FluentStack Orientation="Orientation.Horizontal" HorizontalGap="0">
<div>Preview:</div>
<FluentIcon Id="@id" Value="@context.Icon" Width="20px" />
<FluentTooltip Anchor="@id" Position="TooltipPosition.Right">
@context.Default
</FluentTooltip>
</FluentStack>
}
else
{
<div>
@context.Default
</div>
}
</TemplateColumn>
<PropertyColumn Property="@(c => c.Default)" />

<TemplateColumn Title="Description">
<div style="white-space: break-spaces">
@(new MarkupString(context.Description))
Expand Down
8 changes: 6 additions & 2 deletions examples/Demo/Shared/Components/ApiDocumentation.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ private class MemberDescription
public string? Default { get; set; } = null;
public string Description { get; set; } = "";
public bool IsParameter { get; set; }
public Icon? Icon { get; set; }
}

private IEnumerable<MemberDescription>? _allMembers = null;
Expand Down Expand Up @@ -110,16 +111,18 @@ private IEnumerable<MemberDescription> GetMembers(MemberTypes type)
// Parameters/properties
if (!isEvent)
{
Icon? icon = null;
var defaultVaue = "";
if (propertyInfo.PropertyType.IsValueType || propertyInfo.PropertyType == typeof(string))
{
defaultVaue = obj?.GetType().GetProperty(propertyInfo.Name)?.GetValue(obj)?.ToString();
}
else if (propertyInfo.PropertyType == typeof(Icon))
{
if (obj?.GetType().GetProperty(propertyInfo.Name)?.GetValue(obj) is Icon icon)
if (obj?.GetType().GetProperty(propertyInfo.Name)?.GetValue(obj) is Icon value)
{
defaultVaue = $"{icon.Variant}.{icon.Size}.{icon.Name}";
icon = value;
defaultVaue = $"{value.Variant}.{value.Size}.{value.Name}";
}
}

Expand All @@ -132,6 +135,7 @@ private IEnumerable<MemberDescription> GetMembers(MemberTypes type)
Default = defaultVaue,
Description = CodeComments.GetSummary(Component.Name + "." + propertyInfo.Name) ?? CodeComments.GetSummary(Component.BaseType?.Name + "." + propertyInfo.Name),
IsParameter = isParameter,
Icon = icon
});
}

Expand Down