Skip to content

Commit

Permalink
Introduced new ButtonBase class to allow for greater flexibility
Browse files Browse the repository at this point in the history
  • Loading branch information
abjerner committed Mar 15, 2021
1 parent cd111b2 commit a8298f5
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 7 deletions.
8 changes: 5 additions & 3 deletions src/Skybrud.Forms/Models/Fields/Button.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
namespace Skybrud.Forms.Models.Fields {

public class Button : FieldBase {
public class Button : ButtonBase {

protected const string FieldType = "button";

#region Constructors

public Button() : base("button", null, null) { }
public Button() : base(FieldType) { }

protected Button(string type) : base(type, null, null) { }
public Button(string name, string label) : base(FieldType, name, label) { }

#endregion

Expand Down
15 changes: 15 additions & 0 deletions src/Skybrud.Forms/Models/Fields/ButtonBase.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace Skybrud.Forms.Models.Fields {

public abstract class ButtonBase : FieldBase {

#region Constructors

protected ButtonBase(string type) : base(type, null, null) { }

protected ButtonBase(string type, string name, string label) : base(type, name, label) { }

#endregion

}

}
8 changes: 6 additions & 2 deletions src/Skybrud.Forms/Models/Fields/ResetButton.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
namespace Skybrud.Forms.Models.Fields {

public class ResetButton : Button {
public class ResetButton : ButtonBase {

protected const string FieldType = "reset";

#region Constructors

public ResetButton() : base("reset") { }
public ResetButton() : base(FieldType) { }

public ResetButton(string name, string label) : base(FieldType, name, label) { }

#endregion

Expand Down
8 changes: 6 additions & 2 deletions src/Skybrud.Forms/Models/Fields/SubmitButton.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
namespace Skybrud.Forms.Models.Fields {

public class SubmitButton : Button {
public class SubmitButton : ButtonBase {

protected const string FieldType = "button";

#region Constructors

public SubmitButton() : base("submit") { }
public SubmitButton() : base(FieldType) { }

public SubmitButton(string name, string label) : base(FieldType, name, label) { }

#endregion

Expand Down

0 comments on commit a8298f5

Please sign in to comment.