]> git.ipfire.org Git - thirdparty/bulma.git/commitdiff
Add nav, Enhance tabs
authorJeremy Thomas <bbxdesign@gmail.com>
Sat, 7 May 2016 22:40:06 +0000 (23:40 +0100)
committerJeremy Thomas <bbxdesign@gmail.com>
Sat, 7 May 2016 22:40:06 +0000 (23:40 +0100)
sass/base/helpers.sass
sass/components/components.sass
sass/components/nav.sass [new file with mode: 0644]
sass/components/tabs.sass
sass/elements/button.sass
sass/elements/other.sass
sass/layout/header.sass
sass/layout/hero.sass
sass/utilities/mixins.sass
sass/utilities/variables.sass

index 2e4bec260d644cc35bddf0ebd088d94d765b1a5b..68c964c032790fd6d34e4c2cec535f769abb728c 100644 (file)
@@ -101,4 +101,4 @@ $displays: 'block' 'flex' 'inline' 'inline-block' 'inline-flex'
   margin: 0 !important
 
 .is-unselectable
-  +unselectable
+  @extend .unselectable
index 66919e9233a900bc84eb040e42a3f1daeeb9acb4..6ed164ba65b31429de4591d9c61f8e31a28fa259 100644 (file)
@@ -7,6 +7,7 @@
 @import "menu"
 @import "message"
 @import "modal"
+@import "nav"
 @import "navbar"
 @import "pagination"
 @import "panel"
diff --git a/sass/components/nav.sass b/sass/components/nav.sass
new file mode 100644 (file)
index 0000000..5f6ea20
--- /dev/null
@@ -0,0 +1,104 @@
+.nav
+  align-items: stretch
+  background: $white
+  display: flex
+  min-height: $nav-height
+  position: relative
+  text-align: center
+  z-index: 2
+  & > .container
+    align-items: stretch
+    display: flex
+    min-height: $nav-height
+    width: 100%
+  +tablet
+    & > .container
+      & > .nav-left
+        margin-left: -10px
+      & > .nav-right
+        margin-left: -10px
+
+.nav-toggle
+  @extend .hamburger
+  // Responsiveness
+  +tablet
+    display: none
+
+// Elements
+
+.nav-item
+  align-items: center
+  display: flex
+  justify-content: center
+  padding: 10px
+  a
+    flex-grow: 1
+  img
+    max-height: 24px
+  .button + .button
+    margin-left: 10px
+  .tag
+    &:first-child
+      margin-right: 5px
+    &:last-child
+      margin-left: 5px
+  // Responsiveness
+  +mobile
+    justify-content: flex-start
+
+.nav-item a,
+a.nav-item
+  color: $text
+  &:hover
+    color: $link-hover
+  // Modifiers
+  &.is-active
+    color: $link-active
+
+.nav-tab
+  align-items: center
+  border-bottom: 1px solid transparent
+  color: $text
+  display: block
+  height: $nav-height
+  line-height: 24px
+  padding: 13px 15px
+  &:hover
+    border-bottom: 1px solid $link
+  // Modifiers
+  &.is-active
+    border-bottom: 3px solid $link
+    color: $link
+
+// Containers
+
+.nav-menu
+  // Responsiveness
+  +mobile
+    background: $white
+    box-shadow: 0 4px 7px rgba($black, 0.1)
+    left: 0
+    display: none
+    right: 0
+    top: 100%
+    position: absolute
+    .nav-item
+      border-top: 1px solid rgba($border, 0.5)
+      padding: 10px
+    // Modifiers
+    &.is-active
+      display: block
+
+.nav-left
+  align-items: stretch
+  display: flex
+  flex: 1
+  overflow: hidden
+  overflow-x: auto
+  white-space: nowrap
+
+.nav-right
+  align-items: stretch
+  // Responsiveness
+  +tablet
+    display: flex
index 20bf233096cdb2851dca220bcbbbc05e37fe0940..a9000f2e359060553801cf0e48ba84a84dabe0f4 100644 (file)
@@ -1,5 +1,9 @@
 .tabs
   @extend .block
+  @extend .unselectable
+  align-items: stretch
+  display: flex
+  justify-content: space-between
   line-height: 24px
   overflow: hidden
   overflow-x: auto
     display: flex
     justify-content: center
     margin-bottom: -1px
-    padding: 5px 0
+    padding: 6px 12px
     vertical-align: top
     &:hover
       border-bottom-color: $text-strong
       color: $text-strong
   li
     display: block
-    vertical-align: top
-    & + li
-      margin-left: 20px
-    // Modifiers
     &.is-active
       a
         border-bottom-color: $link
         color: $link
   ul
+    align-items: center
     border-bottom: 1px solid $border
     display: flex
+    flex: 1
+    justify-content: flex-start
+    &.is-left
+      padding-right: 10px
+    &.is-center
+      flex: none
+      justify-content: center
+      padding-left: 10px
+      padding-right: 10px
+    &.is-right
+      justify-content: flex-end
+      padding-left: 10px
   .icon
     &:first-child
-      margin-right: 5px
+      margin-right: 8px
     &:last-child
-      margin-left: 5px
-  // Modifiers
+      margin-left: 8px
+  // Alignment
+  &.is-centered
+    ul
+      justify-content: center
+  &.is-right
+    ul
+      justify-content: flex-end
+  // Styles
   &.is-boxed
     a
       border: 1px solid transparent
       border-radius: $radius $radius 0 0
-      padding: 5px 15px
+      padding-bottom: 5px
+      padding-top: 5px
       &:hover
         background: $background
         border-bottom-color: $border
     li
-      & + li
-        margin-left: 5px
-      // Modifiers
       &.is-active
         a
           background: $white
           border-color: $border
           border-bottom-color: transparent
-    // Modifiers
-    &.is-centered
-      li
-        &,
-        & + li
-          margin: 0 2px
-  &.is-centered
-    a
-      padding: 5px 10px
-    li
-      & + li
-        margin-left: 0
-    ul
-      justify-content: center
-      text-align: center
   &.is-fullwidth
     li
       flex: 1
-      & + li
-        margin-left: 0
-    ul
-      justify-content: center
-      text-align: center
-  &.is-right
-    ul
-      justify-content: flex-end
   &.is-toggle
     a
       border: 1px solid $border
       margin-bottom: 0
-      padding: 5px 10px
+      padding-bottom: 5px
+      padding-top: 5px
       position: relative
       &:hover
         background: $background
@@ -95,7 +91,6 @@
         border-radius: $radius 0 0 $radius
       &:last-child a
         border-radius: 0 $radius $radius 0
-      // Modifiers
       &.is-active
         a
           background: $primary
           z-index: 1
     ul
       border-bottom: none
+  // Sizes
+  &.is-small
+    font-size: $size-small
+    a
+      padding: 2px 8px
+    &.is-boxed,
+    &.is-toggle
+      a
+        padding-bottom: 1px
+        padding-top: 1px
+  &.is-medium
+    font-size: $size-medium
+    a
+      padding: 10px 16px
+    &.is-boxed,
+    &.is-toggle
+      a
+        padding-bottom: 9px
+        padding-top: 9px
+  &.is-large
+    font-size: $size-large
+    a
+      padding: 14px 20px
+    &.is-boxed,
+    &.is-toggle
+      a
+        padding-bottom: 13px
+        padding-top: 13px
index 8a6a30b75c23e695ee4499bcd97ad38ae87e4f84..9d34f21fd3c40ed3951e7a38c6cbcfa6e85a4632 100644 (file)
@@ -18,7 +18,7 @@
 
 .button
   +control
-  +unselectable
+  @extend .unselectable
   justify-content: center
   padding-left: 10px
   padding-right: 10px
@@ -95,8 +95,6 @@
   &[disabled],
   &.is-disabled
     opacity: 0.5
-  &.is-flexible
-    height: auto
   &.is-fullwidth
     display: block
     width: 100%
index 9f78d087967b17656c60cc1ad7fd686c0cf71af7..e92bb0953320dac808949c0703f0475ea0be39c8 100644 (file)
@@ -1,5 +1,5 @@
 .delete
-  +unselectable
+  @extend .unselectable
   -moz-appearance: none
   -webkit-appearance: none
   background: rgba($black, 0.2)
@@ -56,9 +56,9 @@
 .hamburger
   cursor: pointer
   display: block
-  height: 50px
+  height: $nav-height
   position: relative
-  width: 50px
+  width: $nav-height
   span
     background: $text
     display: block
@@ -92,9 +92,6 @@
         margin-left: -5px
         transform: rotate(-45deg)
         transform-origin: left bottom
-  +tablet
-    height: $header-height
-    width: $header-height
 
 .heading
   display: block
     .delete
       margin-left: 4px
       margin-right: -8px
+
+.unselectable
+  -webkit-touch-callout: none
+  -webkit-user-select: none
+  -moz-user-select: none
+  -ms-user-select: none
+  user-select: none
+
index b1ed6c0ca6548ba4f2de83aabc8fb4663c57e637..f45dfebda833e2835b72ceb5a28121914a1f4e6f 100644 (file)
@@ -3,16 +3,18 @@
   background: $white
   display: flex
   line-height: 24px
+  min-height: $header-height
   position: relative
   text-align: center
   z-index: 2
   .container
     align-items: stretch
     display: flex
+    min-height: $header-height
     width: 100%
   // Modifiers
   &.has-shadow
-    box-shadow: 0 1px 2px rgba($black, 0.1)
+    box-shadow: 0 2px 3px rgba($black, 0.1)
   // Responsiveness
   +mobile
     .container
@@ -62,13 +64,6 @@ a.header-item
   &.is-active
     color: $link-active
 
-.header-icon
-  +fa(14px, 24px)
-  color: $text
-  margin: 0 5px
-  &:hover
-    color: $link-hover
-
 .header-tab
   align-items: center
   border-bottom: 1px solid transparent
index b9d8de05080c24c61f0b1777dc56b44101bb1e2c..c8d08c17e1102700053ac596bc559cb215c05dde 100644 (file)
@@ -1,3 +1,5 @@
+// Components
+
 .hero-video
   +overlay
   overflow: hidden
   +mobile
     display: none
 
-.hero-content
-  padding: 40px 20px
-  // Responsiveness
-  +desktop
-    padding: 40px 0
-
 .hero-buttons
   margin-top: 20px
   // Responsiveness
   +mobile
     .button
-      display: block
+      display: flex
       &:not(:last-child)
         margin-bottom: 10px
   +tablet
     .button:not(:last-child)
       margin-right: 20px
 
+// Containers
+
+.hero-head,
+.hero-foot
+  flex-shrink: 0
+
+.hero-body
+  flex: 1
+  padding: 40px 20px
+  // Responsiveness
+  +desktop
+    padding-left: 0
+    padding-right: 0
+
+// Main container
+
 .hero
+  align-items: stretch
   background: $white
-  .header
+  display: flex
+  flex-direction: column
+  justify-content: space-between
+  .nav
     background: none
-    .container
+    & > .container
       box-shadow: 0 1px 0 rgba($border, 0.3)
   .tabs
     a
       border: none
     ul
       border-bottom: none
-    // Modifiers
-    &.is-boxed
-      a
-        padding: 8px 15px
   // Colors
   @each $name, $pair in $colors
     $color: nth($pair, 1)
         a,
         strong
           color: $color-invert
-      .header .container
-        box-shadow: 0 1px 0 rgba($color-invert, 0.2)
-      .header-icon,
-      a.header-item,
-      .header-item > a:not(.button)
+      .nav
+        & > .container
+          box-shadow: 0 1px 0 rgba($color-invert, 0.2)
+      a.nav-item,
+      .nav-item a:not(.button)
         color: rgba($color-invert, 0.5)
         &:hover,
         &.is-active
@@ -82,8 +94,9 @@
           opacity: 0.5
           &:hover
             opacity: 1
-        li.is-active a
-          opacity: 1
+        li
+          &.is-active a
+            opacity: 1
         &.is-boxed,
         &.is-toggle
           a
         background-image: linear-gradient(141deg, $gradient-top-left 0%, $color 71%, $gradient-bottom-right 100%)
       // Responsiveness
       +mobile
-        .header-toggle
+        .nav-toggle
           span
             background: $color-invert
           &:hover
           &.is-active
             span
               background: $color-invert
-        .header-menu
-          .header-item
+        .nav-menu
+          .nav-item
             border-top-color: rgba($color-invert, 0.2)
   // Sizes
-  &.is-fullheight,
-  &.is-large
-    // Responsiveness
-    +tablet
-      .tabs
-        font-size: $size-medium
   &.is-medium
-    // Responsiveness
     +tablet
-      .hero-content
-        padding: 120px 20px
-    +desktop
-      .hero-content
-        padding: 120px 0
+      .hero-body
+        padding-bottom: 120px
+        padding-top: 120px
+  &.is-large
+    +tablet
+      .hero-body
+        padding-bottom: 240px
+        padding-top: 240px
   &.is-fullheight
-    align-items: stretch
-    display: flex
-    flex-direction: column
-    justify-content: space-between
     min-height: 100vh
-    .tabs
-      a
-        padding: 15px 20px
-    .hero-content
+    .hero-body
+      align-items: stretch
       display: flex
-      flex: 1
       flex-direction: column
       justify-content: center
-  &.is-large
-    .tabs
-      a
-        padding: 10px 15px
-    // Responsiveness
-    +tablet
-      .hero-content
-        padding: 240px 20px
-    +desktop
-      .hero-content
-        padding: 240px 0
+      padding-bottom: 240px
+      padding-top: 240px
index fb20fd2a0663b6adaa82862b03728504eb537e90..e1802963834ad9f100722c6a73cc380b67825805 100644 (file)
   text-indent: -290486px
   width: $width
 
-=unselectable
-  -webkit-touch-callout: none
-  -webkit-user-select: none
-  -moz-user-select: none
-  -ms-user-select: none
-  user-select: none
-
 =from($device)
   @media screen and (min-width: $device)
     @content
index 5b1635ea5c33abb13f9b0532edcac182174a8f7c..433c31f892476ba750f8776e140973a5d89e41bc 100644 (file)
@@ -49,6 +49,8 @@ $column-gap: 20px !default
 
 $header-height: 50px !default
 
+$nav-height: 50px !default
+
 // Miscellaneous
 
 $easing: ease-out !default