From d0ef03baa28c3b45f7186e26506c8569f09b2bb4 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Fri, 10 Jan 2025 12:01:59 +0800 Subject: [PATCH 1/3] feat: add is-flat-flash style --- src/BootstrapBlazor/Components/Light/Light.razor.cs | 1 + src/BootstrapBlazor/Components/Light/Light.razor.scss | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/BootstrapBlazor/Components/Light/Light.razor.cs b/src/BootstrapBlazor/Components/Light/Light.razor.cs index 645f3867397..207a8e30ffb 100644 --- a/src/BootstrapBlazor/Components/Light/Light.razor.cs +++ b/src/BootstrapBlazor/Components/Light/Light.razor.cs @@ -16,6 +16,7 @@ public partial class Light protected string? ClassString => CssBuilder.Default("light") .AddClass("is-flat", IsFlat) .AddClass("flash", IsFlash && !IsFlat) + .AddClass("is-flat-flash", IsFlash && IsFlat) .AddClass($"light-{Color.ToDescriptionString()}", Color != Color.None) .AddClassFromAttributes(AdditionalAttributes) .Build(); diff --git a/src/BootstrapBlazor/Components/Light/Light.razor.scss b/src/BootstrapBlazor/Components/Light/Light.razor.scss index f5f8d89eb55..ee8e22ad6d9 100644 --- a/src/BootstrapBlazor/Components/Light/Light.razor.scss +++ b/src/BootstrapBlazor/Components/Light/Light.razor.scss @@ -76,6 +76,9 @@ height: 100%; border-radius: 50%; border: 1px solid var(--bb-light-bg); + } + + &.is-flat-flash:after { animation: light-flat 1.2s infinite ease-in-out; } } @@ -196,7 +199,7 @@ @include animation(light-danger, #e17777, #892726); @include animation(light-success, #5cb85c, #116811); @include animation(light-info, #5bc0de, #1d7792); -@include animation(light-light-warning, #ffc107, #cc9f18); +@include animation(light-warning, #ffc107, #cc9f18); @include animation(light-primary, #007bff, #0f5fb5); @include animation(light-secondary, #6c757d, #4b5054); @include animation(light-dark, #6061e2, #3232a0); From 3dd7acc8420995eed81e0f3de16b15d6f9539131 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Fri, 10 Jan 2025 12:02:12 +0800 Subject: [PATCH 2/3] =?UTF-8?q?doc:=20=E6=9B=B4=E6=96=B0=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Samples/Lights.razor | 6 +++--- src/BootstrapBlazor.Server/Locales/en-US.json | 8 +++++--- src/BootstrapBlazor.Server/Locales/zh-CN.json | 4 +++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/BootstrapBlazor.Server/Components/Samples/Lights.razor b/src/BootstrapBlazor.Server/Components/Samples/Lights.razor index 3f2f2733bcb..5c8c3f7ef22 100644 --- a/src/BootstrapBlazor.Server/Components/Samples/Lights.razor +++ b/src/BootstrapBlazor.Server/Components/Samples/Lights.razor @@ -94,13 +94,13 @@
- +
- +
- +
diff --git a/src/BootstrapBlazor.Server/Locales/en-US.json b/src/BootstrapBlazor.Server/Locales/en-US.json index 915acf97e59..e0889d409c9 100644 --- a/src/BootstrapBlazor.Server/Locales/en-US.json +++ b/src/BootstrapBlazor.Server/Locales/en-US.json @@ -485,12 +485,14 @@ "LightsNormalTitle": "common usage", "LightsNormalIntro": "for status indication", "LightsFlashingTitle": "flicker", - "LightsFlashingIntro": "Flash the light by setting the property IsFlash", + "LightsFlashingIntro": "Flash the light by setting the parameter IsFlash", "LightsColorTitle": "discoloration", - "LightsColorIntro": "Color the light by setting the value of the property Color", + "LightsColorIntro": "Color the light by setting the value of the parameter Color", "LightsTooltipTextTitle": "prompt text", "LightsTooltipTextIntro": "By setting the value of the attribute TooltipText to make the tooltip text prompt when the mouse hovers over the indicator light", - "TooltipText": "I am prompt text message" + "TooltipText": "I am prompt text message", + "LightsFlatTitle": "Flat", + "LightsFlatIntro": "Make the indicator light flat by setting the parameter IsFlat" }, "BootstrapBlazor.Server.Components.Samples.Charts.Index": { "Chart": "Chart", diff --git a/src/BootstrapBlazor.Server/Locales/zh-CN.json b/src/BootstrapBlazor.Server/Locales/zh-CN.json index 752915f9235..987242b7deb 100644 --- a/src/BootstrapBlazor.Server/Locales/zh-CN.json +++ b/src/BootstrapBlazor.Server/Locales/zh-CN.json @@ -490,7 +490,9 @@ "LightsColorIntro": "通过设置属性 Color 值使指示灯进行变色", "LightsTooltipTextTitle": "提示文字", "LightsTooltipTextIntro": "通过设置属性 TooltipText 值使鼠标悬浮指示灯上时提示 tooltip 文字", - "TooltipText": "我是提示文字信息" + "TooltipText": "我是提示文字信息", + "LightsFlatTitle": "扁平化", + "LightsFlatIntro": "通过设置属性 IsFlat 使指示灯扁平化" }, "BootstrapBlazor.Server.Components.Samples.Charts.Index": { "Chart": "Chart 图表", From c2c2e854a8894b6b79e651fdeb8a5d2c1b89d6c7 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Fri, 10 Jan 2025 12:03:56 +0800 Subject: [PATCH 3/3] =?UTF-8?q?test:=20=E6=9B=B4=E6=96=B0=E5=8D=95?= =?UTF-8?q?=E5=85=83=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/UnitTest/Components/LightTest.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/UnitTest/Components/LightTest.cs b/test/UnitTest/Components/LightTest.cs index f16276d9f7c..c03bcbd07d2 100644 --- a/test/UnitTest/Components/LightTest.cs +++ b/test/UnitTest/Components/LightTest.cs @@ -11,14 +11,16 @@ public class LightTest : BootstrapBlazorTestBase public void IsFlash_Ok() { var cut = Context.RenderComponent(builder => builder.Add(s => s.IsFlash, true)); - Assert.Contains("flash", cut.Markup); + Assert.Contains("light flash", cut.Markup); + Assert.DoesNotContain("is-flash-flat", cut.Markup); cut.SetParametersAndRender(pb => { pb.Add(a => a.IsFlat, true); }); - Assert.DoesNotContain("flash", cut.Markup); + Assert.DoesNotContain("light flash", cut.Markup); Assert.Contains("is-flat", cut.Markup); + Assert.Contains("is-flat-flash", cut.Markup); } [Fact]