Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit 2127243

Browse files
Eric Jimeneznaomiblack
authored andcommitted
feat(badging): Enum only matches enums, as opposed to Const and Enums. Const matches const, var, and let
1 parent 0ae7ade commit 2127243

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

public/_includes/_hero.jade

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
- var capitalize = function capitalize(str) { return str.charAt(0).toUpperCase() + str.slice(1); }
55
- var useBadges = docType || stability;
66

7+
// renamer :: String -> String
8+
// Renames `Let` and `Var` into `Const`
9+
- var renamer = function renamer(docType) {
10+
- return (docType === 'Let' || docType === 'Var') ? 'Const' : docType
11+
- }
12+
713
if current.path[4] && current.path[3] == 'api'
814
- var textFormat = 'is-standard-case'
915

@@ -14,7 +20,7 @@ header(class="hero background-sky")
1420
span(class="badges")
1521
if docType
1622
span(class="status-badge").
17-
#{capitalize(docType)}
23+
#{renamer(capitalize(docType))}
1824
if stability
1925
span(layout="row" class="status-badge")
2026
// badge circle is filled based on stability by matching a css selector in _hero.scss

public/resources/css/module/_api.scss

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,16 @@
2020
content: 'F';
2121
background: #0f9d58;
2222
}
23-
&.const:before,
2423
&.enum:before {
25-
content: 'N';
24+
content: 'E';
2625
background: #757575;
2726
}
27+
28+
// NOTE: (ericjim): `var`, `let`, and `const` are considered Const
2829
&.var:before,
29-
&.let:before {
30-
content: 'V';
30+
&.let:before,
31+
&.const:before {
32+
content: 'K'; // Use K for const, since C is already used for Class
3133
background: #9575cd;
3234
}
3335
&:before {

public/resources/js/directives/api-list.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ angularIO.directive('apiList', function () {
3232
{ cssClass: 'class', title: 'Class', matches: ['class'] },
3333
{ cssClass: 'interface', title: 'Interface', matches: ['interface'] },
3434
{ cssClass: 'function', title: 'Function', matches: ['function'] },
35-
{ cssClass: 'const', title: 'Const or Enum', matches: ['const', 'enum'] },
36-
{ cssClass: 'var', title: 'Variable', matches: ['var', 'let'] }
35+
{ cssClass: 'enum', title: 'Enum', matches: ['enum'] },
36+
{ cssClass: 'const', title: 'Const', matches: ['var', 'let', 'const'] }
3737
];
3838

3939
$ctrl.apiFilter = getApiFilterFromLocation();

0 commit comments

Comments
 (0)