feat(badging): Enum only matches enums, as opposed to Const and Enums. Const matches const, var, and let
This commit is contained in:
		
							parent
							
								
									0ae7ade9fa
								
							
						
					
					
						commit
						21272435a3
					
				| @ -4,6 +4,12 @@ | |||||||
| - var capitalize = function capitalize(str) { return str.charAt(0).toUpperCase() + str.slice(1); } | - var capitalize = function capitalize(str) { return str.charAt(0).toUpperCase() + str.slice(1); } | ||||||
| - var useBadges = docType || stability; | - var useBadges = docType || stability; | ||||||
| 
 | 
 | ||||||
|  | // renamer :: String -> String | ||||||
|  | // Renames `Let` and `Var` into `Const` | ||||||
|  | - var renamer = function renamer(docType) { | ||||||
|  | -   return (docType === 'Let' || docType === 'Var') ? 'Const' : docType | ||||||
|  | - } | ||||||
|  | 
 | ||||||
| if current.path[4] && current.path[3] == 'api' | if current.path[4] && current.path[3] == 'api' | ||||||
|   - var textFormat = 'is-standard-case' |   - var textFormat = 'is-standard-case' | ||||||
| 
 | 
 | ||||||
| @ -14,7 +20,7 @@ header(class="hero background-sky") | |||||||
|     span(class="badges") |     span(class="badges") | ||||||
|       if docType |       if docType | ||||||
|         span(class="status-badge"). |         span(class="status-badge"). | ||||||
|           #{capitalize(docType)} |           #{renamer(capitalize(docType))} | ||||||
|       if stability |       if stability | ||||||
|         span(layout="row" class="status-badge") |         span(layout="row" class="status-badge") | ||||||
|           // badge circle is filled based on stability by matching a css selector in _hero.scss |           // badge circle is filled based on stability by matching a css selector in _hero.scss | ||||||
|  | |||||||
| @ -20,14 +20,16 @@ | |||||||
|     content: 'F'; |     content: 'F'; | ||||||
|     background: #0f9d58; |     background: #0f9d58; | ||||||
|   } |   } | ||||||
|   &.const:before, |  | ||||||
|   &.enum:before { |   &.enum:before { | ||||||
|     content: 'N'; |     content: 'E'; | ||||||
|     background: #757575; |     background: #757575; | ||||||
|   } |   } | ||||||
|  | 
 | ||||||
|  |   // NOTE: (ericjim): `var`, `let`, and `const` are considered Const | ||||||
|   &.var:before, |   &.var:before, | ||||||
|   &.let:before { |   &.let:before, | ||||||
|     content: 'V'; |   &.const:before { | ||||||
|  |     content: 'K'; // Use K for const, since C is already used for Class | ||||||
|     background: #9575cd; |     background: #9575cd; | ||||||
|   } |   } | ||||||
|   &:before { |   &:before { | ||||||
|  | |||||||
| @ -32,8 +32,8 @@ angularIO.directive('apiList', function () { | |||||||
|         { cssClass: 'class', title: 'Class', matches: ['class'] }, |         { cssClass: 'class', title: 'Class', matches: ['class'] }, | ||||||
|         { cssClass: 'interface', title: 'Interface', matches: ['interface'] }, |         { cssClass: 'interface', title: 'Interface', matches: ['interface'] }, | ||||||
|         { cssClass: 'function', title: 'Function', matches: ['function'] }, |         { cssClass: 'function', title: 'Function', matches: ['function'] }, | ||||||
|         { cssClass: 'const', title: 'Const or Enum', matches: ['const', 'enum'] }, |         { cssClass: 'enum', title: 'Enum', matches: ['enum'] }, | ||||||
|         { cssClass: 'var', title: 'Variable', matches: ['var', 'let'] } |         { cssClass: 'const', title: 'Const', matches: ['var', 'let', 'const'] } | ||||||
|       ]; |       ]; | ||||||
| 
 | 
 | ||||||
|       $ctrl.apiFilter = getApiFilterFromLocation(); |       $ctrl.apiFilter = getApiFilterFromLocation(); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user