Guest User

Untitled

a guest
Nov 21st, 2014
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.06 KB | None | 0 0
  1. Pitchtarget
  2. Index
  3. Colors
  4. Components
  5. Guidelines
  6. Icons
  7. Guidelines
  8. General
  9.  
  10. Indent using 2 spaces
  11. All filenames should be lowercased
  12. Javascript
  13.  
  14. Naming Convention
  15.  
  16. d-a-s-h-e-s for file names, folder names, ember components
  17. camelCase Javascript, JSON
  18. Code convention
  19.  
  20. Varibles declaration with var: always
  21. Declare one variable per var statement, it makes it easier to re-order the lines
  22. Prefer ' over "
  23. Always use semicolons ;
  24. Always use parentheses (also for if statement of one line)
  25. Prefer forEach over for loop
  26. General advices
  27.  
  28. BE CONSISTENT. If you're editing code, take a few minutes to look at the code around you and determine its style. If they use spaces around all their arithmetic operators, you should too. If their comments have little boxes of hash marks around them, make your comments have little boxes of hash marks around them too. The point of having style guidelines is to have a common vocabulary of coding so people can concentrate on what you're saying rather than on how you're saying it. We present global style rules here so people know the vocabulary, but local style is also important. If code you add to a file looks drastically different from the existing code around it, it throws readers out of their rhythm when they go to read it. Avoid this.
  29.  
  30. CSS
  31.  
  32. General
  33.  
  34. app.less is used only for importing other styles
  35. Do not use selectors based on Id
  36. Avoid element selectors, prefer classes
  37. // wrong
  38. <div class="folder">
  39. <span>Folder Name</span>
  40. </div>
  41.  
  42. /* The Folder Module */
  43. .fld > span { ... }
  44.  
  45. // right
  46. <div class="folder">
  47. <span class="folder--name">Folder Name</span>
  48. <span class="folder--items">(32 items)</span>
  49. </div>
  50.  
  51. .fld--items { ... }
  52. .fld--name { ... }
  53. In less files avoid using deep nesting (more than 3 levels). Nest media queries
  54. Avoid extending classes, use mixins instead. Extending a class leads to ugly output in term of css selectors.
  55. Design Principles
  56.  
  57. Modules are entities that are aware of the context in which they are placed and can be used as standalone components. They are the reusable, modular parts of our design. Buttons, navs, dropdowns, forms, etc are great examples of components. Class name convention for module is .moduleName
  58. Sub Modules are variations of a module in term of graphics, these variations are based on context, for example if we have a .btn class for rapresenting a button with 100px width and we want a button with 200px width we can create a submodule .btn-large that redefines the width property. Class name convention for sub-module is .module-subModule
  59. Sub Components are necessarly placed inside a module and rappresent pieces of the module structure e.g
  60. .modal {}
  61. .modal-large {}
  62. .modal--header {}
  63.  
  64. <div class="modal modal-large">
  65. <div class="modal--header">...</div>
  66. <div class="modal--body">...</div>
  67. <div class="modal--footer">...</div>
  68. </div>
  69. Class name convention for sub-components is .module--subComponent
  70. States are modifiers that describe how our modules will look when they are in a particular state. Generally speaking the difference between sub-modules and states is that the second one is used when the state depends on some javascript properties e.g:
  71. // Normally we have the 'btn' module
  72. <button class="btn">OK</button>
  73.  
  74. // If some javascript can alter the state of the button and make it disabled
  75. // then we have to add the state btn-is-disabled
  76. <button class="btn btn-is-disabled">OK</button>
  77. Class name convention for states is .module-is-state
  78. Try to avoid conditional styling based on location. If you are changing the look of a module for usage elsewhere on the page or site, sub-class the module instead.
  79. For state class (i.e when need to change appearance based on behavior) use something like: .tab-is-active where 'tab' is the name of the module or the name of the component.
  80. Common situations
  81.  
  82. <button class="btn">Cancel</button>
  83.  
  84. <div class="modal modal-large">
  85. <div class="modal--header">...</div>
  86. <div class="modal--body">...</div>
  87. <div class="modal--footer">
  88. <button></button>
  89. </div>
  90. </div>
Advertisement
Add Comment
Please, Sign In to add comment