Bläddra i källkod

Improve snippet

Jeremy Thomas 7 år sedan
förälder
incheckning
1f5f9dc54b
5 ändrade filer med 45 tillägg och 73 borttagningar
  1. 1 13
      docs/_javascript/main.js
  2. 0 31
      docs/_sass/example.sass
  3. 26 27
      docs/css/bulma-docs.css
  4. 1 0
      docs/css/bulma-docs.css.map
  5. 17 2
      docs/lib/main.js

+ 1 - 13
docs/_javascript/main.js

@@ -107,24 +107,12 @@ document.addEventListener('DOMContentLoaded', () => {
       const expandEl = '<button class="button is-small bd-expand">Expand</button>';
       $el.insertAdjacentHTML('beforeend', copyEl);
 
-<<<<<<< HEAD
       const $parent = $el.parentNode;
       if ($parent && $parent.classList.contains('bd-is-more')) {
         const showEl = '<button class="bd-show"><div><span class="icon"><i class="fa fa-code"></i></span> <strong>Show code</strong></div></button>';
         $el.insertAdjacentHTML('beforeend', showEl);
       } else if ($el.firstElementChild.scrollHeight > 480 && $el.firstElementChild.clientHeight <= 480) {
         $el.insertAdjacentHTML('beforeend', expandEl);
-=======
-      if ($el.firstElementChild.scrollHeight > 480 && $el.firstElementChild.clientHeight <= 480) {
-        $el.insertAdjacentHTML('beforeend', expandEl);
-      }
-
-      const $parent = $el.parentNode;
-      if ($parent && $parent.className == 'bd-highlight-clipped') {
-        const showEl = '<button class="bd-show"><div><span class="icon"><i class="fa fa-code"></i></span> <strong>Show code</strong></div></button>';
-        $el.classList.add('bd-is-clipped');
-        $el.insertAdjacentHTML('beforeend', showEl);
->>>>>>> Add show code
       }
 
       itemsProcessed++;
@@ -159,7 +147,7 @@ document.addEventListener('DOMContentLoaded', () => {
 
     $highlightShows.forEach($el => {
       $el.addEventListener('click', () => {
-        $el.parentNode.classList.remove('bd-is-clipped');
+        $el.parentNode.parentNode.classList.remove('bd-is-more-clipped');
       });
     });
   }

+ 0 - 31
docs/_sass/example.sass

@@ -42,10 +42,6 @@
     margin-top: -1.5rem
     &:not(:last-child)
       margin-bottom: 1.5rem
-  & + .bd-highlight-clipped
-    margin-top: -1.5rem
-    &:not(:last-child)
-      margin-bottom: 1.5rem
 
 // Snippet
 .bd-snippet
@@ -214,33 +210,6 @@ $structure-invert: $danger-invert
     pre
       white-space: pre-wrap
 
-.bd-highlight-clipped
-  .bd-show
-    +overlay
-    align-items: center
-    background-color: rgba(#000, 0.9)
-    background-image: linear-gradient(rgba(#000, 0), rgba(#000, 0) 90%, rgba(#000, 1))
-    border: none
-    color: $white
-    cursor: pointer
-    display: none
-    font-size: $size-6
-    justify-content: center
-    opacity: 0.7
-    width: 100%
-    strong
-      color: currentColor
-      font-weight: $weight-semibold
-    &:hover
-      opacity: 0.8
-  .highlight.bd-is-clipped
-    height: 4em
-    overflow: hidden
-    pre
-        overflow: hidden
-    .bd-show
-      display: flex
-
 +tablet
   .section:not(.is-fullwidth) > .bd-example:not(.is-fullwidth)
     margin-left: 1.5rem

+ 26 - 27
docs/css/bulma-docs.css

@@ -10565,14 +10565,6 @@ html.route-index #carbon {
   margin-bottom: 1.5rem;
 }
 
-.bd-example + .bd-highlight-clipped {
-  margin-top: -1.5rem;
-}
-
-.bd-example + .bd-highlight-clipped:not(:last-child) {
-  margin-bottom: 1.5rem;
-}
-
 .bd-snippet {
   border: 1px solid #ffdd57;
   margin-top: 2rem;
@@ -10607,8 +10599,11 @@ html.route-index #carbon {
 }
 
 .bd-snippet-code.bd-is-more.bd-is-more-clipped .highlight .bd-show {
+<<<<<<< HEAD
   display: -webkit-box;
   display: -ms-flexbox;
+=======
+>>>>>>> Improve snippet
   display: flex;
 }
 
@@ -10661,7 +10656,12 @@ html.route-index #carbon {
 >>>>>>> Use link instead of primary
 =======
     align-items: stretch;
+<<<<<<< HEAD
 >>>>>>> Add love data
+=======
+    border-radius: 5px;
+    border-top-left-radius: 0;
+>>>>>>> Improve snippet
     display: flex;
     justify-content: center;
   }
@@ -10685,6 +10685,7 @@ html.route-index #carbon {
     display: -ms-flexbox;
 =======
     align-items: stretch;
+<<<<<<< HEAD
 >>>>>>> Use link instead of primary
 =======
     -webkit-box-align: stretch;
@@ -10706,6 +10707,9 @@ html.route-index #carbon {
 =======
     align-items: stretch;
 >>>>>>> Add love data
+=======
+    border-radius: 0 5px 5px 0;
+>>>>>>> Improve snippet
     display: flex;
     flex-direction: column;
   }
@@ -10837,6 +10841,7 @@ html.route-index #carbon {
 }
 
 .highlight .bd-show {
+<<<<<<< HEAD
   bottom: 0;
   left: 0;
   position: absolute;
@@ -10874,44 +10879,38 @@ html.route-index #carbon {
 }
 
 .bd-highlight-clipped .bd-show {
+=======
+>>>>>>> Improve snippet
   bottom: 0;
   left: 0;
   position: absolute;
   right: 0;
   top: 0;
   align-items: center;
-  background-color: rgba(0, 0, 0, 0.9);
-  background-image: linear-gradient(transparent, transparent 90%, black);
+  background-color: rgba(245, 245, 245, 0.7);
   border: none;
-  color: white;
+  color: rgba(0, 0, 0, 0.5);
   cursor: pointer;
   display: none;
-  font-size: 1rem;
+  font-size: 0.75rem;
   justify-content: center;
-  opacity: 0.7;
   width: 100%;
 }
 
-.bd-highlight-clipped .bd-show strong {
+.highlight .bd-show strong {
   color: currentColor;
   font-weight: 600;
 }
 
-.bd-highlight-clipped .bd-show:hover {
-  opacity: 0.8;
-}
-
-.bd-highlight-clipped .highlight.bd-is-clipped {
-  height: 4em;
-  overflow: hidden;
-}
-
-.bd-highlight-clipped .highlight.bd-is-clipped pre {
-  overflow: hidden;
+.highlight .bd-show:hover {
+  background-color: rgba(255, 221, 87, 0.8);
+  color: rgba(0, 0, 0, 0.7);
 }
 
-.bd-highlight-clipped .highlight.bd-is-clipped .bd-show {
-  display: flex;
+@media screen and (min-width: 769px), print {
+  .highlight pre {
+    white-space: pre-wrap;
+  }
 }
 
 @media screen and (min-width: 769px), print {

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 0
docs/css/bulma-docs.css.map


+ 17 - 2
docs/lib/main.js

@@ -109,6 +109,7 @@ document.addEventListener('DOMContentLoaded', function () {
       var expandEl = '<button class="button is-small bd-expand">Expand</button>';
       $el.insertAdjacentHTML('beforeend', copyEl);
 
+<<<<<<< HEAD
 <<<<<<< HEAD
       var $parent = $el.parentNode;
       if ($parent && $parent.classList.contains('bd-is-more')) {
@@ -121,12 +122,18 @@ document.addEventListener('DOMContentLoaded', function () {
         $el.insertAdjacentHTML('beforeend', expandEl);
       }
 
+=======
+>>>>>>> Improve snippet
       var $parent = $el.parentNode;
-      if ($parent && $parent.className == 'bd-highlight-clipped') {
+      if ($parent && $parent.classList.contains('bd-is-more')) {
         var showEl = '<button class="bd-show"><div><span class="icon"><i class="fa fa-code"></i></span> <strong>Show code</strong></div></button>';
-        $el.classList.add('bd-is-clipped');
         $el.insertAdjacentHTML('beforeend', showEl);
+<<<<<<< HEAD
 >>>>>>> Add show code
+=======
+      } else if ($el.firstElementChild.scrollHeight > 480 && $el.firstElementChild.clientHeight <= 480) {
+        $el.insertAdjacentHTML('beforeend', expandEl);
+>>>>>>> Improve snippet
       }
 
       itemsProcessed++;
@@ -157,6 +164,7 @@ document.addEventListener('DOMContentLoaded', function () {
       });
     });
 
+<<<<<<< HEAD
 <<<<<<< HEAD
     var $highlightShows = getAll('.highlight .bd-show');
 
@@ -170,6 +178,13 @@ document.addEventListener('DOMContentLoaded', function () {
       $el.addEventListener('click', function () {
         $el.parentNode.classList.remove('bd-is-clipped');
 >>>>>>> Add show code
+=======
+    var $highlightShows = getAll('.highlight .bd-show');
+
+    $highlightShows.forEach(function ($el) {
+      $el.addEventListener('click', function () {
+        $el.parentNode.parentNode.classList.remove('bd-is-more-clipped');
+>>>>>>> Improve snippet
       });
     });
   }

Vissa filer visades inte eftersom för många filer har ändrats