diff --git a/Havit.Blazor.Components.Web.Bootstrap/Havit.Blazor.Components.Web.Bootstrap.csproj b/Havit.Blazor.Components.Web.Bootstrap/Havit.Blazor.Components.Web.Bootstrap.csproj index 30c8cac92..5a923a7da 100644 --- a/Havit.Blazor.Components.Web.Bootstrap/Havit.Blazor.Components.Web.Bootstrap.csproj +++ b/Havit.Blazor.Components.Web.Bootstrap/Havit.Blazor.Components.Web.Bootstrap.csproj @@ -45,6 +45,7 @@ + diff --git a/Havit.Blazor.Components.Web.Bootstrap/Navigation/HxSidebar.razor b/Havit.Blazor.Components.Web.Bootstrap/Navigation/HxSidebar.razor index 8e3c51c49..96a162899 100644 --- a/Havit.Blazor.Components.Web.Bootstrap/Navigation/HxSidebar.razor +++ b/Havit.Blazor.Components.Web.Bootstrap/Navigation/HxSidebar.razor @@ -1,58 +1,62 @@ @namespace Havit.Blazor.Components.Web.Bootstrap
-
\ No newline at end of file diff --git a/Havit.Blazor.Components.Web.Bootstrap/Navigation/HxSidebar.razor.cs b/Havit.Blazor.Components.Web.Bootstrap/Navigation/HxSidebar.razor.cs index 024857ffd..c8ed8d70e 100644 --- a/Havit.Blazor.Components.Web.Bootstrap/Navigation/HxSidebar.razor.cs +++ b/Havit.Blazor.Components.Web.Bootstrap/Navigation/HxSidebar.razor.cs @@ -1,4 +1,6 @@ -namespace Havit.Blazor.Components.Web.Bootstrap; +using Microsoft.Extensions.Localization; + +namespace Havit.Blazor.Components.Web.Bootstrap; /// /// Sidebar component - responsive navigation sidebar.
@@ -17,14 +19,16 @@ public partial class HxSidebar : ComponentBase [Parameter] public RenderFragment ItemsTemplate { get; set; } /// - /// Icon for expanding the desktop version. Use for more specific customization. + /// ExpandIcon is obsolete and will be removed in future release. Use if you want to render an icon. /// - [Parameter] public IconBase ExpandIcon { get; set; } = BootstrapIcon.ChevronBarRight; + [Obsolete("ExpandIcon is obsolete and will be removed in future release. Use TogglerTemplate if you want to render an icon.")] + [Parameter] public IconBase ExpandIcon { get; set; } /// - /// Icon for collapsing the desktop version. Use for more specific customization. + /// CollapseIcon is obsolete and will be removed in future release. Use if you want to render an icon. /// - [Parameter] public IconBase CollapseIcon { get; set; } = BootstrapIcon.ChevronBarLeft; + [Obsolete("CollapseIcon is obsolete and will be removed in future release. Use TogglerTemplate if you want to render an icon.")] + [Parameter] public IconBase CollapseIcon { get; set; } /// /// Sidebar footer (e.g. logged user, language switch, ...). @@ -32,7 +36,7 @@ public partial class HxSidebar : ComponentBase [Parameter] public RenderFragment FooterTemplate { get; set; } /// - /// Vertical toggler (desktop version) to be rendered instead of the and icon. + /// Vertical toggler (desktop version) to be rendered instead of the default bar/arrow. /// [Parameter] public RenderFragment TogglerTemplate { get; set; } @@ -73,6 +77,8 @@ public partial class HxSidebar : ComponentBase /// [Parameter] public SidebarResponsiveBreakpoint ResponsiveBreakpoint { get; set; } = SidebarResponsiveBreakpoint.Medium; + [Inject] protected IStringLocalizer Localizer { get; set; } + protected internal string NavContentElementId => Id + "-nav-content"; /// diff --git a/Havit.Blazor.Components.Web.Bootstrap/Navigation/HxSidebar.razor.css b/Havit.Blazor.Components.Web.Bootstrap/Navigation/HxSidebar.razor.css index 463d067dd..d23709432 100644 --- a/Havit.Blazor.Components.Web.Bootstrap/Navigation/HxSidebar.razor.css +++ b/Havit.Blazor.Components.Web.Bootstrap/Navigation/HxSidebar.razor.css @@ -62,25 +62,42 @@ transform: translate(-50%, -50%); } -.hx-sidebar-toggler-icon-wrapper { - opacity: 0; - width: 2em; - height: 2em; - border-radius: 50%; - border: var(--hx-sidebar-toggler-border); - align-items: center; - justify-content: center; +.hx-sidebar-toggler-inner { + display: block; + padding: .75rem; +} + +.hx-sidebar-toggler-arrow { + width: .25rem; + height: .75rem; + border-radius: .25rem; background-color: var(--hx-sidebar-toggler-background); - color: var(--hx-sidebar-toggler-color); transition: all .25s ease-in-out; + transform: translateY(.15rem) rotate(0deg) translateZ(0px); +} + +.hx-sidebar-toggler:hover .hx-sidebar-toggler-arrow { + background-color: var(--bs-body-color); +} + +.hx-sidebar-toggler-arrow + .hx-sidebar-toggler-arrow { + transform: translateY(-.15rem) rotate(0deg) translateZ(0px); +} + +.hx-sidebar-toggler:hover .hx-sidebar-toggler-arrow { + transform: translateY(.15rem) rotate(15deg) translateZ(0px); +} + +.hx-sidebar-toggler:hover .hx-sidebar-toggler-arrow + .hx-sidebar-toggler-arrow { + transform: translateY(-.15rem) rotate(-15deg) translateZ(0px); } -.hx-sidebar:hover .hx-sidebar-toggler-icon-wrapper { - opacity: .75; +.collapsed .hx-sidebar-toggler:hover .hx-sidebar-toggler-arrow { + transform: translateY(.15rem) rotate(-15deg) translateZ(0px); } -.hx-sidebar .hx-sidebar-toggler-icon-wrapper:hover { - opacity: 1; +.collapsed .hx-sidebar-toggler:hover .hx-sidebar-toggler-arrow + .hx-sidebar-toggler-arrow { + transform: translateY(-.15rem) rotate(15deg) translateZ(0px); } .hx-sidebar-navbar-toggler:hover { diff --git a/Havit.Blazor.Components.Web.Bootstrap/Resources/HxSidebar.cs.resx b/Havit.Blazor.Components.Web.Bootstrap/Resources/HxSidebar.cs.resx new file mode 100644 index 000000000..e71177de5 --- /dev/null +++ b/Havit.Blazor.Components.Web.Bootstrap/Resources/HxSidebar.cs.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Sbalit + + + Rozbalit + + \ No newline at end of file diff --git a/Havit.Blazor.Components.Web.Bootstrap/Resources/HxSidebar.it-IT.resx b/Havit.Blazor.Components.Web.Bootstrap/Resources/HxSidebar.it-IT.resx new file mode 100644 index 000000000..70ccb698f --- /dev/null +++ b/Havit.Blazor.Components.Web.Bootstrap/Resources/HxSidebar.it-IT.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Comprimi + + + Espandi + + \ No newline at end of file diff --git a/Havit.Blazor.Components.Web.Bootstrap/Resources/HxSidebar.resx b/Havit.Blazor.Components.Web.Bootstrap/Resources/HxSidebar.resx new file mode 100644 index 000000000..f26ae0eb6 --- /dev/null +++ b/Havit.Blazor.Components.Web.Bootstrap/Resources/HxSidebar.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Collapse + + + Expand + + \ No newline at end of file diff --git a/Havit.Blazor.Components.Web.Bootstrap/Resources/HxSidebar.zh-CN.resx b/Havit.Blazor.Components.Web.Bootstrap/Resources/HxSidebar.zh-CN.resx new file mode 100644 index 000000000..08937f340 --- /dev/null +++ b/Havit.Blazor.Components.Web.Bootstrap/Resources/HxSidebar.zh-CN.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 折叠 + + + 展开 + + \ No newline at end of file diff --git a/Havit.Blazor.Components.Web.Bootstrap/wwwroot/defaults.css b/Havit.Blazor.Components.Web.Bootstrap/wwwroot/defaults.css index 9ac389556..70a5d4450 100644 --- a/Havit.Blazor.Components.Web.Bootstrap/wwwroot/defaults.css +++ b/Havit.Blazor.Components.Web.Bootstrap/wwwroot/defaults.css @@ -13,9 +13,7 @@ --hx-sidebar-background-color: transparent; --hx-sidebar-collapsed-width: 72px; --hx-sidebar-width: 250px; - --hx-sidebar-toggler-border: 1px solid var(--bs-border-color); - --hx-sidebar-toggler-background: var(--bs-body-bg); - --hx-sidebar-toggler-color: var(--bs-body-color); + --hx-sidebar-toggler-background: var(--bs-gray-500); --hx-sidebar-item-font-size: 1rem; --hx-sidebar-item-padding: .75rem; --hx-sidebar-item-color: var(--bs-body-color); diff --git a/Havit.Blazor.Documentation/Pages/Components/HxSidebarDoc/HxSidebar_Demo_TogglerTemplate.razor b/Havit.Blazor.Documentation/Pages/Components/HxSidebarDoc/HxSidebar_Demo_TogglerTemplate.razor index 188d844c1..bbda35fde 100644 --- a/Havit.Blazor.Documentation/Pages/Components/HxSidebarDoc/HxSidebar_Demo_TogglerTemplate.razor +++ b/Havit.Blazor.Documentation/Pages/Components/HxSidebarDoc/HxSidebar_Demo_TogglerTemplate.razor @@ -28,7 +28,7 @@ } else { - + CLOSE diff --git a/Havit.Blazor.Documentation/Pages/Components/HxSidebarDoc/HxSidebar_Documentation.razor b/Havit.Blazor.Documentation/Pages/Components/HxSidebarDoc/HxSidebar_Documentation.razor index a7f3a4c29..5f1301a1c 100644 --- a/Havit.Blazor.Documentation/Pages/Components/HxSidebarDoc/HxSidebar_Documentation.razor +++ b/Havit.Blazor.Documentation/Pages/Components/HxSidebarDoc/HxSidebar_Documentation.razor @@ -24,7 +24,10 @@ -

With TogglerTemplate you can set a custom toggler for the desktop version to be rendered instead of the default ExpandIcon and CollapseIcon. Render varying content based on the SidebarTogglerTemplateContext.

+

+ With TogglerTemplate you can set a custom toggler for the desktop version to be rendered instead of the default visual. + Render varying content based on the SidebarTogglerTemplateContext. +

@@ -49,14 +52,8 @@ Width of the sidebar. - - Toggler border. - - - Toggler background. - - - Toggler color. + + Toggler bar/arrow background. Font size of the items. diff --git a/Havit.Blazor.Documentation/XmlDoc/Havit.Blazor.Components.Web.Bootstrap.xml b/Havit.Blazor.Documentation/XmlDoc/Havit.Blazor.Components.Web.Bootstrap.xml index 52d24e054..2829a2ba5 100644 --- a/Havit.Blazor.Documentation/XmlDoc/Havit.Blazor.Components.Web.Bootstrap.xml +++ b/Havit.Blazor.Documentation/XmlDoc/Havit.Blazor.Components.Web.Bootstrap.xml @@ -7978,12 +7978,12 @@ - Icon for expanding the desktop version. Use for more specific customization. + ExpandIcon is obsolete and will be removed in future release. Use if you want to render an icon. - Icon for collapsing the desktop version. Use for more specific customization. + CollapseIcon is obsolete and will be removed in future release. Use if you want to render an icon. @@ -7993,7 +7993,7 @@ - Vertical toggler (desktop version) to be rendered instead of the and icon. + Vertical toggler (desktop version) to be rendered instead of the default bar/arrow.