|
| 1 | +<!-- Open Graph --> |
1 | 2 | <meta property="og:title" content="Carbon Components Angular"> |
2 | 3 | <meta property="og:description" content="An Angular implementation of the Carbon Design System for IBM."> |
3 | 4 | <meta property="og:image" content="https://angular.carbondesignsystem.com/carbon.jpg"> |
4 | 5 | <meta property="og:url" content="https://angular.carbondesignsystem.com"> |
5 | 6 |
|
| 7 | +<!-- Social --> |
6 | 8 | <meta name="twitter:title" content="Carbon Components Angular"> |
7 | 9 | <meta name="twitter:description" content="An Angular implementation of the Carbon Design System for IBM."> |
8 | 10 | <meta name="twitter:image" content="https://angular.carbondesignsystem.com/carbon.jpg"> |
9 | 11 | <meta name="twitter:card" content="summary_large_image"> |
| 12 | + |
| 13 | +<!-- Storybook override --> |
| 14 | +<script> |
| 15 | + document.title = "Carbon Components Angular"; |
| 16 | +</script> |
| 17 | + |
| 18 | +<style id="iframestyle"> |
| 19 | +.sb-show-main:not(.welcome) { |
| 20 | + padding: 3em; |
| 21 | + display: flex; |
| 22 | + flex-direction: column; |
| 23 | + align-items: center; |
| 24 | +} |
| 25 | +.experimental .toggle-btn, |
| 26 | +.toggle-btn { |
| 27 | + padding: 9px; |
| 28 | + background: white; |
| 29 | + border: none; |
| 30 | + border-radius: 5px; |
| 31 | + color: darkcyan; |
| 32 | + transition: all 0.2s ease-out; |
| 33 | + outline: 0; |
| 34 | + cursor: pointer; |
| 35 | +} |
| 36 | +.experimental .experimental-selected, |
| 37 | +.experimental-selected { |
| 38 | + background: darkcyan; |
| 39 | + color: white; |
| 40 | +} |
| 41 | +</style> |
| 42 | + |
| 43 | +<script> |
| 44 | +function setExperimental(event) { |
| 45 | + var frame = document.querySelector("#storybook-preview-iframe"); |
| 46 | + var classList = frame.contentDocument.body.classList; |
| 47 | + if(event.target.previousElementSibling) { |
| 48 | + classList.add("experimental"); |
| 49 | + classList.remove("carbon"); |
| 50 | + event.target.previousElementSibling.classList.remove("experimental-selected"); |
| 51 | + } else { |
| 52 | + classList.remove("experimental"); |
| 53 | + classList.add("carbon"); |
| 54 | + event.target.nextElementSibling.classList.remove("experimental-selected"); |
| 55 | + } |
| 56 | + event.target.classList.add("experimental-selected"); |
| 57 | +}; |
| 58 | + |
| 59 | +var experimentalToggleInterval = setInterval(function() { |
| 60 | + var frame = document.querySelector("#storybook-preview-iframe"); |
| 61 | + if(!frame || |
| 62 | + !frame.contentDocument || |
| 63 | + !frame.contentDocument.getElementById("root")) { |
| 64 | + return; |
| 65 | + } |
| 66 | + |
| 67 | + frame.contentDocument.head.appendChild( |
| 68 | + document.getElementById("iframestyle") |
| 69 | + ); |
| 70 | + |
| 71 | + clearInterval(experimentalToggleInterval); |
| 72 | + frame.contentDocument.body.insertAdjacentHTML( |
| 73 | + "beforeend", |
| 74 | + `<div style="position: fixed; right: 15px; bottom: 15px"> |
| 75 | + <button |
| 76 | + class="toggle-btn experimental-selected" |
| 77 | + onclick="setExperimental(event)"> |
| 78 | + Standard |
| 79 | + </button> |
| 80 | + <button |
| 81 | + class="toggle-btn" |
| 82 | + onclick="setExperimental(event)"> |
| 83 | + Experimental |
| 84 | + </button> |
| 85 | + </div> |
| 86 | + `); |
| 87 | + frame.contentWindow.setExperimental = setExperimental; |
| 88 | + |
| 89 | + var classList = frame.contentDocument.body.classList; |
| 90 | + classList.add("carbon"); |
| 91 | +}, 100); |
| 92 | +</script> |
0 commit comments