Skip to content

Commit

Permalink
🎬 docs(Usage): remove the ambiguous dynamic parameter for Elevation (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
capdiem authored Jul 17, 2024
1 parent 55141a0 commit 4eb8a12
Show file tree
Hide file tree
Showing 9 changed files with 0 additions and 102 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ public Usage() : base(typeof(AdvanceUsage))
{ nameof(MAlert.Dismissible), new CheckboxParameter("false", true) }
};

protected override ParameterList<SliderParameter> GenSliderParameters() => new()
{
{ nameof(MAlert.Elevation), new SliderParameter(0, 0, 24) }
};

protected override ParameterList<SelectParameter> GenSelectParameters() => new()
{
{ nameof(MAlert.Color), new SelectParameter(new List<string>() { "red", "orange", "yellow", "green", "blue", "purple" }) },
Expand All @@ -49,7 +44,6 @@ public Usage() : base(typeof(AdvanceUsage))
nameof(MAlert.Icon) => (StringBoolean)(string)parameter.Value,
nameof(MAlert.Border) => Enum.Parse<Borders>((string)parameter.Value),
nameof(MAlert.Type) => Enum.Parse<AlertTypes>((string)parameter.Value),
nameof(MAlert.Elevation) => (StringNumber)(double)parameter.Value,
_ => parameter.Value
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ public class Usage : Masa.Blazor.Docs.Components.Usage
{ nameof(MAppBar.Shaped), false },
};

protected override ParameterList<SliderParameter> GenSliderParameters() => new()
{
{ nameof(MAppBar.Elevation), new SliderParameter(4, 0, 24) }
};

protected override ParameterList<SelectParameter> GenSelectParameters() => new()
{
{ nameof(MAppBar.Color), new SelectParameter(new List<string>() { "red", "orange", "yellow", "green", "blue", "purple" }) },
Expand All @@ -40,7 +35,6 @@ public Usage() : base(typeof(MAppBar)) { }
return parameter.Key switch
{
nameof(MAppBar.Rounded) => (StringBoolean)(bool)parameter.Value,
nameof(MAppBar.Elevation) => (StringNumber)(double)parameter.Value,
_ => parameter.Value
};
}
Expand Down
19 changes: 0 additions & 19 deletions docs/Masa.Blazor.Docs/Examples/components/banners/Usage.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ public class Usage : Masa.Blazor.Docs.Components.Usage
{ nameof(MBanner.Sticky), false },
};

protected override ParameterList<SliderParameter> GenSliderParameters() => new()
{
{ nameof(MBanner.Elevation), new SliderParameter(0, 0, 24) }
};

protected override ParameterList<SelectParameter> GenSelectParameters() => new()
{
{ nameof(MBanner.Color), new SelectParameter(new List<string>() { "accent", "primary","secondary"}) },
Expand All @@ -27,19 +22,5 @@ protected override RenderFragment GenChildContent() => builder =>
};

public Usage() : base(typeof(MBanner)) { }

protected override object? CastValue(ParameterItem<object?> parameter)
{
if (parameter.Value == null)
{
return parameter.Value;
}

return parameter.Key switch
{
nameof(MBanner.Elevation) => (StringNumber)(double)parameter.Value,
_ => parameter.Value
};
}
}
}
19 changes: 0 additions & 19 deletions docs/Masa.Blazor.Docs/Examples/components/buttons/Usage.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,10 @@ public Usage() : base(typeof(MButton))
{ nameof(MButton.XSmall), new CheckboxParameter("false", true) },
};

protected override ParameterList<SliderParameter> GenSliderParameters() => new()
{
{ nameof(MButton.Elevation), new SliderParameter(2, 0, 24) }
};

protected override ParameterList<SelectParameter> GenSelectParameters() => new()
{
{ nameof(MButton.Color), new SelectParameter(new List<string>() { "accent", "primary", "secondary" }) },
};

protected override RenderFragment GenChildContent() => builder => builder.AddContent(0, "Click Me");

protected override object? CastValue(ParameterItem<object?> parameter)
{
if (parameter.Value == null)
{
return parameter.Value;
}

return parameter.Key switch
{
nameof(MButton.Elevation) => (StringNumber)(double)parameter.Value,
_ => parameter.Value
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ public Usage() : base(typeof(MCard))
{ nameof(MCard.Loading), new CheckboxParameter() },
};

protected override ParameterList<SliderParameter> GenSliderParameters() => new()
{
{ nameof(MButton.Elevation), new SliderParameter(2, 0, 24) }
};

protected override RenderFragment GenChildContent() => builder =>
{
builder.OpenComponent<MCardTitle>(0);
Expand Down Expand Up @@ -68,7 +63,6 @@ protected override RenderFragment GenChildContent() => builder =>

return parameter.Key switch
{
nameof(MCard.Elevation) => (StringNumber)(double)parameter.Value,
nameof(MCard.Loading) => (StringBoolean)(bool)parameter.Value,
_ => parameter.Value
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ public Usage() : base(typeof(MButton))
{ nameof(MButton.XSmall), new CheckboxParameter("false", true) },
};

protected override ParameterList<SliderParameter> GenSliderParameters() => new()
{
{ nameof(MButton.Elevation), new SliderParameter(2, 0, 24) }
};

protected override ParameterList<SelectParameter> GenSelectParameters() => new()
{
{ nameof(MButton.Color), new SelectParameter(new List<string>() { "accent", "primary", "secondary" }) },
Expand All @@ -45,20 +40,6 @@ protected override RenderFragment GenChildContent() => builder =>
builder.CloseComponent();
};

protected override object? CastValue(ParameterItem<object?> parameter)
{
if (parameter.Value == null)
{
return parameter.Value;
}

return parameter.Key switch
{
nameof(MButton.Elevation) => (StringNumber)(double)parameter.Value,
_ => parameter.Value
};
}

protected override Dictionary<string, object>? GenAdditionalParameters()
{
return new Dictionary<string, object>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ public class Usage : Masa.Blazor.Docs.Components.Usage

protected override ParameterList<SliderParameter> GenSliderParameters() => new()
{
{ nameof(MSheet.Elevation), new SliderParameter(1, 0, 24, false) },
{ nameof(MSheet.Height), new SliderParameter(100, 50 , 250, false) },
{ nameof(MSheet.Width), new SliderParameter(100, 50, 250, false) },
};
Expand All @@ -34,7 +33,6 @@ public Usage() : base(typeof(MSheet))

return parameter.Key switch
{
nameof(MSheet.Elevation) => (StringNumber)(double)parameter.Value,
nameof(MSheet.Height) => (StringNumber)(double)parameter.Value,
nameof(MSheet.Width) => (StringNumber)(double)parameter.Value,
nameof(MSheet.Rounded) => (StringBoolean)(bool)parameter.Value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,10 @@ public Usage() : base(typeof(MSkeletonLoader))
}
};

protected override ParameterList<SliderParameter> GenSliderParameters() => new()
{
{ nameof(MSkeletonLoader.Elevation), new SliderParameter(1, 0, 24, false) }
};

protected override Dictionary<string, object>? GenAdditionalParameters() => new()
{
{ nameof(MSkeletonLoader.MinWidth), (StringNumber)300 }
};

protected override IEnumerable<string> AdditionalParameters => ["MinWidth=\"300\""];

protected override object? CastValue(ParameterItem<object?> parameter)
{
if (parameter.Value == null)
{
return parameter.Value;
}

return parameter.Key switch
{
nameof(MSkeletonLoader.Elevation) => (StringNumber)(double)parameter.Value,
_ => parameter.Value
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ public class Usage : Masa.Blazor.Docs.Components.Usage
{ nameof(MToolbar.Shaped), false },
};

protected override ParameterList<SliderParameter> GenSliderParameters() => new()
{
{ nameof(MToolbar.Elevation), new SliderParameter(4, 0, 24) }
};

protected override ParameterList<SelectParameter> GenSelectParameters() => new()
{
{ nameof(MToolbar.Color), new SelectParameter(new List<string>() { "red", "orange", "yellow", "green", "blue", "purple" }) },
Expand All @@ -40,7 +35,6 @@ public Usage() : base(typeof(MToolbar)) { }
return parameter.Key switch
{
nameof(MToolbar.Rounded) => (StringBoolean)(bool)parameter.Value,
nameof(MToolbar.Elevation) => (StringNumber)(double)parameter.Value,
_ => parameter.Value
};
}
Expand Down

0 comments on commit 4eb8a12

Please sign in to comment.