|
| 1 | +# The Primo New UI Customization Workflow Development Environment |
| 2 | + |
| 3 | + |
| 4 | +##css documentation |
| 5 | + |
| 6 | +- Primo uses Angular Directives massively in this project |
| 7 | + |
| 8 | +- To learn more about directives see: |
| 9 | +> https://docs.angularjs.org/guide/directive |
| 10 | +
|
| 11 | +- Primo uses external directives from the Angular-material framework : |
| 12 | +> https://material.angularjs.org/latest/ |
| 13 | +
|
| 14 | +- Those directives are tagged by a prefix : "md-" |
| 15 | + |
| 16 | +- Primo also creates its own directives which are tagged by the "prm-" prefix. |
| 17 | + |
| 18 | + |
| 19 | +Example: |
| 20 | +``` |
| 21 | + <header layout="column" layout-fill class="topbar-wrapper"> |
| 22 | + <prm-topbar> |
| 23 | + </prm-topbar> |
| 24 | +
|
| 25 | + <prm-search-bar (search-event)="prmSearch.onSearchBarSearchEvent()"> |
| 26 | + </prm-search-bar> |
| 27 | +
|
| 28 | + <md-progress-linear class="header-progress-bar animation-scale-up-down" md-mode="indeterminate" ng-show="prmSearch.searchInProgress"> |
| 29 | + </md-progress-linear> |
| 30 | +
|
| 31 | + </header> |
| 32 | +``` |
| 33 | + |
| 34 | + |
| 35 | +- You can see in the example how we use : |
| 36 | + |
| 37 | +1. An HTML5 tag - header |
| 38 | +2. A Primo directive : prm-topbar , prm-search-bar. |
| 39 | +3. An external material design directive : md-progress-bar : |
| 40 | +> https://material.angularjs.org/latest/api/directive/mdProgressLinear |
| 41 | +
|
| 42 | + |
| 43 | + |
| 44 | +- When defining css rules it is important to understand the css cascading/specifity logic: |
| 45 | + |
| 46 | +> http://www.w3.org/TR/css3-cascade/ |
| 47 | +
|
| 48 | +> https://specificity.keegan.st/ |
| 49 | +
|
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | +- When you start working on customizing your css be aware of the ability to define css selectors based on the directive name, which is actually equivalent |
| 54 | +to an html tag - this will enable you changing the design of a component cross-system without relying on id's/classes |
| 55 | + |
| 56 | +- For the example above we can define selectors: |
| 57 | + |
| 58 | +``` |
| 59 | +prm-topbar input {....} |
| 60 | +prm-topbar.md-primoExplore-theme input {....} |
| 61 | +``` |
| 62 | +- Primo is using a theme inside angular-material to define a palette of colors see: |
| 63 | +> https://material.angularjs.org/latest/Theming/01_introduction |
| 64 | +
|
| 65 | + |
| 66 | +- This means that you will often encounter a class "md-primoExplore-theme" attached to elements. |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | +##Recipes/Examples: |
| 71 | + |
| 72 | + |
| 73 | +# css Recipe 1 - Color Scheme |
| 74 | + |
| 75 | +- Open a new command line window |
| 76 | + |
| 77 | +- cd to the project base directory (C:\**\**\primo-explore-devenv) |
| 78 | +- Run `gulp css-colors` to save the OTB css file |
| 79 | +- Run `css-color-extractor primo-explore/tmp/app.css --format=css > primo-explore/tmp/colors.css` to extract the color definitions from the OTB css file and copy the css rules to primo-explore/custom/css/custom1.css |
| 80 | + |
| 81 | + |
| 82 | +Run the following steps repeatedly until you are satisfied with the result |
| 83 | + |
| 84 | + |
| 85 | +- Choose a color from the interface (using your browsers' dev tools or extensions such as colorzilla) |
| 86 | + |
| 87 | + |
| 88 | +- Choose the new color from your library color scheme |
| 89 | +- Replace all values in the custom1.css file |
| 90 | +- Save and refresh your browser |
| 91 | + |
| 92 | + |
| 93 | + |
| 94 | +# css Recipe 2 - Moving the Facets to the Left |
| 95 | + |
| 96 | + |
| 97 | +- Select the parent container containing the search result and the facets |
| 98 | +- Copy the selector definition using your browsers' dev tools |
| 99 | +- Define the container as |
| 100 | +``` |
| 101 | +display:flex; |
| 102 | +flex-flow:row-reverse; |
| 103 | +``` |
| 104 | + |
| 105 | + |
| 106 | +- complete css definition: |
| 107 | +``` |
| 108 | +prm-search > md-content.md-primoExplore-theme .main { |
| 109 | + display: -webkit-flex; !* Safari *! |
| 110 | + -webkit-flex-flow: row-reverse wrap; !* Safari 6.1+ *! |
| 111 | + display: flex; |
| 112 | + flex-flow: row-reverse wrap; |
| 113 | +
|
| 114 | +} |
| 115 | +.screen-gt-sm .sidebar{ |
| 116 | + webkit-flex: 0 0 15%; |
| 117 | + flex: 0 0 15%; |
| 118 | +} |
| 119 | +``` |
| 120 | +- Save and refresh your browser |
| 121 | + |
| 122 | + |
| 123 | + |
| 124 | + |
| 125 | + |
| 126 | + |
| 127 | + |
| 128 | + |
| 129 | + |
0 commit comments