Skip to content

Commit

Permalink
docs(TextField): fix the CustomColors demo (#2090)
Browse files Browse the repository at this point in the history
* 🐛 fix(TextField): fix the CustomColors demo

* fix warnings
  • Loading branch information
capdiem authored Aug 9, 2024
1 parent 13afd28 commit e1c5b0b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,25 +165,25 @@

static List<string> animals = new() { "Dog", "Cat", "Rabbit", "Turtle", "Snake" };

MForm form;
MForm? form;
bool terms;
bool conditions;
bool snackbar;
string content = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec tellus sed augue semper porta. Mauris massa. Vestibulum lacinia arcu eget nulla. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur sodales ligula in libero. Sed dignissim lacinia nunc.";

Model model = new();

bool FormIsValid => form != null && form.EditContext.IsModified() && form.EditContext.Validate();
bool FormIsValid => form?.Value is true;

void ResetForm()
{
form.Reset();
form?.Reset();
}

void Submit()
{
snackbar = true;
form.Reset();
form?.Reset();
}

public class Model
Expand Down
9 changes: 7 additions & 2 deletions src/Masa.Blazor.Docs.ApiGenerator/ApiGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -348,12 +348,17 @@ private static string GetTypeText(INamedTypeSymbol? type)

return null;

static string? GetClassTypeText(INamedTypeSymbol? type)
static string? GetClassTypeText(INamedTypeSymbol type)
{
var properties = type.GetMembers().Where(m => m.Kind == SymbolKind.Property)
.Select(m =>
{
var type = (m as IPropertySymbol).Type;
var type = (m as IPropertySymbol)?.Type;
if (type == null)
{
return (m.Name, Type: string.Empty);
}
if (type.TypeKind == TypeKind.TypeParameter)
{
return (m.Name, Type: type.Name);
Expand Down

0 comments on commit e1c5b0b

Please sign in to comment.