BVB Source Codes

storybook Show index.html.js Source code

Return Download storybook: download index.html.js Source code - Download storybook Source code - Type:.js
  1. import url from 'url';
  2. import { version } from '../../package.json';
  3.  
  4. // assets.manager will be:
  5. // - undefined
  6. // - string e.g. 'static/manager.9adbb5ef965106be1cc3.bundle.js'
  7. // - array of strings e.g.
  8. // assets.manager will be something like:
  9. // [ 'static/manager.c6e6350b6eb01fff8bad.bundle.js',
  10. //   'static/manager.c6e6350b6eb01fff8bad.bundle.js.map' ]
  11. const managerUrlsFromAssets = assets => {
  12.   if (!assets || !assets.manager) {
  13.     return {
  14.       js: 'static/manager.bundle.js',
  15.     };
  16.   }
  17.  
  18.   if (typeof assets.manager === 'string') {
  19.     return {
  20.       js: assets.manager,
  21.     };
  22.   }
  23.  
  24.   return {
  25.     js: assets.manager.find(filename => filename.match(/\.js$/)),
  26.     css: assets.manager.find(filename => filename.match(/\.css$/)),
  27.   };
  28. };
  29.  
  30. export default function(data) {
  31.   const { assets, publicPath } = data;
  32.  
  33.   const managerUrls = managerUrlsFromAssets(assets);
  34.  
  35.   return `
  36.     <!DOCTYPE html>
  37.     <html>
  38.       <head>
  39.         <meta charset="utf-8">
  40.         <meta name="viewport" content="width=device-width, initial-scale=1">
  41.         <meta name="storybook-version" content="${version}">
  42.         <meta content="IE=edge" http-equiv="X-UA-Compatible" />
  43.         <title>Storybook</title>
  44.         <style>
  45.           /*
  46.             When resizing panels, the drag event breaks if the cursor
  47.             moves over the iframe. Add the 'dragging' class to the body
  48.             at drag start and remove it when the drag ends.
  49.            */
  50.           .dragging iframe {
  51.             pointer-events: none;
  52.           }
  53.  
  54.           /* Styling the fuzzy search box placeholders */
  55.           .searchBox::-webkit-input-placeholder { /* Chrome/Opera/Safari */
  56.             color: #ddd;
  57.             font-size: 16px;
  58.           }
  59.  
  60.           .searchBox::-moz-placeholder { /* Firefox 19+ */
  61.             color: #ddd;
  62.             font-size: 16px;
  63.           }
  64.  
  65.           .searchBox:focus{
  66.             border-color: #EEE !important;
  67.           }
  68.  
  69.           .btn:hover{
  70.             background-color: #eee
  71.           }
  72.         </style>
  73.       </head>
  74.       <body style="margin: 0;">
  75.         <div id="root"></div>
  76.         <script src="${url.resolve(publicPath, managerUrls.js)}"></script>
  77.       </body>
  78.     </html>
  79.   `;
  80. }
  81.  
downloadindex.html.js Source code - Download storybook Source code
Related Source Codes/Software:
ionicons - The premium icon font for Ionic ... 2017-06-07
AsyncDisplayKit - Smooth asynchronous user interfaces for iOS apps. ... 2017-06-07
lottie-android - Render After Effects animations natively on Androi... 2017-06-07
parse-server - Parse-compatible API server module for Node/Expres... 2017-06-07
prettier - Prettier is an opinionated JavaScript formatter. ... 2017-06-08
inferno - An extremely fast, React-like JavaScript library f... 2017-06-08
guetzli - Perceptual JPEG encoder 2017-06-08
cs-video-courses - List of Computer Science courses with video lectur... 2017-06-08
interviews - Everything you need to know to get the job. 2017-06-08
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top