Skip to content

Commit d75a222

Browse files
committed
feat(api): Add api item icons
1 parent 0382702 commit d75a222

File tree

4 files changed

+134
-8
lines changed

4 files changed

+134
-8
lines changed

src/app/homepage/api/api-list/api-list.component.html

+10-4
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,18 @@
22
<h1>
33
API List
44
</h1>
5-
<section #content></section>
6-
<section *ngFor="let section of apiSection | async">
7-
<h3>{{ section.title }}</h3>
5+
<section class="api-list" *ngFor="let section of apiSection | async">
6+
<h2>
7+
<a [href]="'/api/' + section.name">{{ section.name }}</a>
8+
</h2>
89
<ul>
910
<li class="api-list-item" *ngFor="let item of section.items">
10-
<a [href]="'/api/' + section.name + '/' + item.title">{{ item.docType }} - {{ item.title }} </a>
11+
<a [href]="'/api/' + section.name + '/' + item.title">
12+
<span class="symbol {{ item.docType }}"></span>
13+
<span class="item-title">
14+
{{ item.title }}
15+
</span>
16+
</a>
1117
</li>
1218
</ul>
1319
</section>

src/app/homepage/api/api-list/api-list.component.scss

+53-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
@import '../../../../scss/variables.scss';
2+
3+
.api-list {
4+
width: 80%;
5+
margin-left: 10%;
6+
}
7+
18
.api-list-item {
29
list-style: none;
310
display: inline-block;
@@ -7,4 +14,49 @@
714

815
ul {
916
padding: 0;
10-
}
17+
}
18+
19+
a {
20+
color: $black-color;
21+
display: inline-block;
22+
line-height: 16px;
23+
overflow: hidden;
24+
text-overflow: ellipsis;
25+
26+
.item-title {
27+
padding: 0 5px;
28+
position: relative;
29+
top: 2px;
30+
}
31+
}
32+
33+
h2 {
34+
a {
35+
font-size: 24px;
36+
color: $red-color;
37+
}
38+
}
39+
40+
.symbol {
41+
border-radius: 2px;
42+
box-shadow: 0 1px 2px rgba($black-color, .24);
43+
color: $white-color;
44+
display: inline-block;
45+
font-size: 10px;
46+
font-weight: 600;
47+
line-height: 16px;
48+
text-align: center;
49+
width: 16px;
50+
51+
// SYMBOL TYPES
52+
// Symbol mapping variables in *constants*
53+
@each $name, $symbol in $api-symbols {
54+
&.#{$name} {
55+
background: map-get($symbol, background);
56+
57+
&:before {
58+
content: map-get($symbol, content);
59+
}
60+
}
61+
}
62+
}

src/app/homepage/api/api-list/api-list.component.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import { Component, OnInit } from '@angular/core';
2-
import { Observable, from } from 'rxjs';
2+
import { Observable } from 'rxjs';
33
import { ApiSection, ApiService } from '../api.service';
4-
import { map, switchMap } from 'rxjs/operators';
5-
import { isNgTemplate } from '@angular/compiler';
64

75
@Component({
86
selector: 'app-api-list',

src/scss/variables.scss

+70
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,73 @@ $grey-color: #404040;
66
$darkgrey-color: #272727;
77
$black-color: #151515;
88
$red-color: #ed2945;
9+
$blue-color: #2196F3;
10+
$dark-blue-color: #0D47A1;
11+
$pink-color: #D81B60;
12+
$amber-color: #FFA000;
13+
$orange-color: #fb8c00;
14+
$green-color: #4CAF50;
15+
$teal-color: #009688;
16+
$purple-color: #8E24AA;
17+
$light-green-color: #7CB342;
18+
$blue-grey-color: #546E7A;
19+
20+
21+
$api-symbols: (
22+
all: (
23+
content: ' ',
24+
background: $white-color
25+
),
26+
class: (
27+
content: 'C',
28+
background: $dark-blue-color
29+
),
30+
const: (
31+
content: 'K',
32+
background: $grey-color
33+
),
34+
decorator: (
35+
content: '@',
36+
background: $blue-color
37+
),
38+
enum: (
39+
content: 'E',
40+
background: $amber-color
41+
),
42+
function: (
43+
content: 'F',
44+
background: $green-color
45+
),
46+
interface: (
47+
content: 'I',
48+
background: $teal-color
49+
),
50+
let: (
51+
content: 'K',
52+
background: $grey-color
53+
),
54+
nestmodule: (
55+
content: 'M',
56+
background: $red-color
57+
),
58+
injectable: (
59+
content: 'I',
60+
background: $orange-color
61+
),
62+
package: (
63+
content: 'Pk',
64+
background: $purple-color
65+
),
66+
pipe: (
67+
content: 'P',
68+
background: $blue-grey-color
69+
),
70+
type-alias: (
71+
content: 'T',
72+
background: $light-green-color
73+
),
74+
var: (
75+
content: 'K',
76+
background: $grey-color
77+
),
78+
);

0 commit comments

Comments
 (0)