myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hno...@apache.org
Subject [myfaces-tobago] branch master updated: improve fixed-header
Date Tue, 01 Oct 2019 14:10:25 GMT
This is an automated email from the ASF dual-hosted git repository.

hnoeth pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git


The following commit(s) were added to refs/heads/master by this push:
     new ebb8883  improve fixed-header
ebb8883 is described below

commit ebb88834003e5419e84264b44f88d53e59d88f6f
Author: Henning Noeth <hnoeth@apache.org>
AuthorDate: Tue Oct 1 16:10:14 2019 +0200

    improve fixed-header
    
    A fixed-header is now 'sticky', which leads to a less flickering page.
    Bootstrap has a 'sticky-top' CSS class which is now used.
---
 .../myfaces/tobago/internal/renderkit/renderer/HeaderRenderer.java | 2 +-
 .../org/apache/myfaces/tobago/renderkit/css/BootstrapClass.java    | 7 ++++++-
 tobago-core/src/main/resources/scss/_tobago.scss                   | 3 +--
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/HeaderRenderer.java
b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/HeaderRenderer.java
index 2ac5098..02d444d 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/HeaderRenderer.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/HeaderRenderer.java
@@ -48,7 +48,7 @@ public class HeaderRenderer extends RendererBase {
     writer.writeClassAttribute(
         TobagoClass.HEADER,
         TobagoClass.HEADER.createMarkup(markup),
-        header.isFixed() ? BootstrapClass.FIXED_TOP : null,
+        header.isFixed() ? BootstrapClass.STICKY_TOP : null,
         header.getCustomClass());
 // TBD: should NAVBAR class be in the LinksRenderer?
     writer.writeAttribute(HtmlAttributes.TITLE, header.getTip(), true);
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/BootstrapClass.java
b/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/BootstrapClass.java
index 3d3b21c..f0f15b4 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/BootstrapClass.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/BootstrapClass.java
@@ -260,6 +260,10 @@ public enum BootstrapClass implements CssItem {
   FIGURE_CAPTION("figure-caption"),
   FIGURE_IMG("figure-img"),
   FIXED_BOTTOM("fixed-bottom"),
+  /**
+   * @deprecated since 5.0.0, please use {@link #STICKY_TOP}
+   */
+  @Deprecated
   FIXED_TOP("fixed-top"),
   FLEX_COLUMN("flex-column"),
   FLEX_COLUMN_REVERSE("flex-column-reverse"),
@@ -367,7 +371,7 @@ public enum BootstrapClass implements CssItem {
   @Deprecated
   NAVBAR_FIXED_BOTTOM("fixed-bottom"),
   /**
-   * @deprecated since 4.0.0, please use {@link #FIXED_TOP}
+   * @deprecated since 4.0.0, please use {@link #STICKY_TOP}
    */
   @Deprecated
   NAVBAR_FIXED_TOP("fixed-top"),
@@ -472,6 +476,7 @@ public enum BootstrapClass implements CssItem {
   ROW("row"),
   SHOW("show"),
   SR_ONLY("sr-only"),
+  STICKY_TOP("sticky-top"),
   TEXT_DANGER("text-danger"),
   TEXT_DARK("text-dark"),
   TEXT_INFO("text-info"),
diff --git a/tobago-core/src/main/resources/scss/_tobago.scss b/tobago-core/src/main/resources/scss/_tobago.scss
index 8a2ccd7..5d1934f 100644
--- a/tobago-core/src/main/resources/scss/_tobago.scss
+++ b/tobago-core/src/main/resources/scss/_tobago.scss
@@ -328,8 +328,7 @@ tobago-file {
 .tobago-header {
   margin-bottom: 1rem;
 
-  &.fixed-top {
-    position: sticky;
+  &.sticky-top {
     margin-top: -$page-padding-top;
     margin-left: -($grid-gutter-width / 2);
     margin-right: -($grid-gutter-width / 2);


Mime
View raw message