first commit -push
This commit is contained in:
34
RobotNet.WebApp/Scripts/Components/ConsoleItem.razor
Normal file
34
RobotNet.WebApp/Scripts/Components/ConsoleItem.razor
Normal file
@@ -0,0 +1,34 @@
|
||||
@implements IDisposable
|
||||
|
||||
@using Microsoft.CodeAnalysis
|
||||
|
||||
<pre class="@Class">
|
||||
@this.Model.Message
|
||||
</pre>
|
||||
|
||||
@code {
|
||||
[Parameter, EditorRequired]
|
||||
public ConsoleItemModel Model { get; set; } = null!;
|
||||
|
||||
string Class => this.Model.Severity switch
|
||||
{
|
||||
DiagnosticSeverity.Info => "console-info",
|
||||
DiagnosticSeverity.Warning => "console-warning",
|
||||
DiagnosticSeverity.Error => "console-error",
|
||||
_ => "console-none"
|
||||
};
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Model.Changed -= StateHasChanged;
|
||||
}
|
||||
|
||||
protected override void OnAfterRender(bool firstRender)
|
||||
{
|
||||
base.OnAfterRender(firstRender);
|
||||
if(firstRender)
|
||||
{
|
||||
Model.Changed += StateHasChanged;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user