Skip to content

Commit cf034f7

Browse files
sjtrimblepetebacondarwin
authored andcommitted
feat(aio): api page styles
Changed description from h3 to h2 to match the other header Created api page classes for consistent styling Add styles for info-bar section Wrapped pre tags for code not to go off of screen
1 parent b0c5d21 commit cf034f7

17 files changed

Lines changed: 135 additions & 65 deletions
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
.api-section {
2+
display: flex;
3+
flex-direction: row;
4+
vertical-align: top;
5+
position: relative;
6+
margin-bottom: 32px;
7+
padding: 8px 0 16px;
8+
9+
pre {
10+
white-space: pre-line;
11+
}
12+
13+
&:after {
14+
content:"";
15+
display: block;
16+
position: absolute;
17+
bottom: 0;
18+
left: 0;
19+
right: 0;
20+
border-bottom: 1px solid $lightgray;
21+
width: 100%;
22+
}
23+
}
24+
25+
.api-section-header {
26+
width: 30%;
27+
display: inline-block;
28+
margin-right: 32px;
29+
30+
h2, p {
31+
margin: 0;
32+
}
33+
}
34+
35+
.api-section-content {
36+
width: 60%;
37+
display: inline-block;
38+
39+
p {
40+
margin: 0 0 8px 0;
41+
}
42+
}

‎aio/src/styles/1-layouts/_layouts-dir.scss‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@
99
@import 'marketing-layout';
1010
@import 'footer';
1111
@import 'layout-global';
12-
@import 'not-found';
12+
@import 'not-found';
13+
@import 'api-page';
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.info-bar {
2+
padding: 32px;
3+
border-radius: 4px;
4+
background-color: rgba($blue, 0.1);
5+
}

‎aio/src/styles/2-modules/_modules-dir.scss‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@
2424
@import 'callout';
2525
@import 'resources';
2626
@import 'edit-page-cta';
27-
@import 'heading-anchors';
27+
@import 'heading-anchors';
28+
@import 'api-info-bar';

‎aio/tools/transforms/templates/class.template.html‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
{% extends 'layout/api-base.template.html' -%}
33

44
{% block details %}
5+
<div class="api-container">
56
{% include "includes/_class-overview.html" %}
67
{% block additional %}{% endblock %}
78
{% include "includes/_description.html" %}
89
{% include "includes/_annotations.html" %}
910
{% include "includes/_constructor.html" %}
1011
{% include "includes/_statics.html" %}
1112
{% include "includes/_members.html" %}
13+
</div>
1214
{% endblock %}

‎aio/tools/transforms/templates/includes/_annotations.html‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{%- if doc.decorators.length %}
2-
<section class="annotations">
3-
<h2>Annotations</h2>
4-
<div class="annotation">
2+
<section class="annotations api-section">
3+
<div class="api-section-header">
4+
<h2>Annotations</h2>
5+
</div>
6+
<div class="annotation api-section-content">
57
{%- for decorator in doc.decorators %}
68
<pre class="prettyprint no-bg">
79
<code>@{$ decorator.name $}{$ params.paramList(decorator.arguments) | indent(10, false) $}</code>
Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,44 @@
1-
<section class="class-overview">
2-
<h2>Class Overview</h2>
3-
<div class="api-doc-code">
1+
<section class="class-overview api-section">
2+
<div class="api-section-header">
3+
<h2>Class Overview</h2>
4+
</div>
5+
<div class="api-section-content">
6+
<div class="api-doc-code">
47

5-
<code class="no-bg openParens">class {$ doc.name $} {</code>
8+
<code class="no-bg openParens">class {$ doc.name $} {</code>
69

7-
{% if doc.statics.length %}
8-
<div class="statics">
9-
{% for member in doc.statics %}{% if not member.internal %}
10-
<pre class="prettyprint no-bg-with-indent"><code>static
11-
<a class="code-anchor" href="#{$ member.name $}-anchor">{$ member.name | indent(6, false) | trim $}</a>
12-
{$ params.paramList(member.parameters) | indent(8, false) | trim $}{$ params.returnType(member.returnType) $}
13-
</code></pre>
14-
{% endif %}{% endfor %}
15-
</div>
16-
{% endif %}
10+
{% if doc.statics.length %}
11+
<div class="statics">
12+
{% for member in doc.statics %}{% if not member.internal %}
13+
<pre class="prettyprint no-bg-with-indent"><code>static
14+
<a class="code-anchor" href="#{$ member.name $}-anchor">{$ member.name | indent(6, false) | trim $}</a>
15+
{$ params.paramList(member.parameters) | indent(8, false) | trim $}{$ params.returnType(member.returnType) $}
16+
</code></pre>
17+
{% endif %}{% endfor %}
18+
</div>
19+
{% endif %}
1720

1821

19-
{% if doc.constructorDoc.name %}
20-
<div class="constructor">
21-
<pre class="prettyprint no-bg-with-indent"><code>
22-
<a class="code-anchor" href="#constructor">{$ doc.constructorDoc.name $}</a>
23-
{$ params.paramList(doc.constructorDoc.parameters) | indent(8, false) | trim $}
24-
</code></pre>
25-
</div>
26-
{% endif %}
27-
28-
{% if doc.members.length %}
29-
<div class="members">
30-
{% for member in doc.members %}{% if not member.internal %}
22+
{% if doc.constructorDoc.name %}
23+
<div class="constructor">
3124
<pre class="prettyprint no-bg-with-indent"><code>
32-
<a class="code-anchor" href="#{$ member.name $}-anchor">{$ member.name | indent(6, false) | trim $}</a>
33-
{$ params.paramList(member.parameters) | indent(8, false) | trim $}{$ params.returnType(member.returnType) $}
25+
<a class="code-anchor" href="#constructor">{$ doc.constructorDoc.name $}</a>
26+
{$ params.paramList(doc.constructorDoc.parameters) | indent(8, false) | trim $}
3427
</code></pre>
35-
{% endif %}{% endfor %}
36-
{% endif %}
28+
</div>
29+
{% endif %}
30+
31+
{% if doc.members.length %}
32+
<div class="members">
33+
{% for member in doc.members %}{% if not member.internal %}
34+
<pre class="prettyprint no-bg-with-indent"><code>
35+
<a class="code-anchor" href="#{$ member.name $}-anchor">{$ member.name | indent(6, false) | trim $}</a>
36+
{$ params.paramList(member.parameters) | indent(8, false) | trim $}{$ params.returnType(member.returnType) $}
37+
</code></pre>
38+
{% endif %}{% endfor %}
39+
{% endif %}
3740

38-
<code class="endParens api-doc-code no-bg">}</code>
41+
<code class="endParens api-doc-code no-bg">}</code>
42+
</div>
3943
</div>
4044
</section>

‎aio/tools/transforms/templates/includes/_constructor.html‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{%- if doc.constructorDoc and not doc.constructorDoc.internal %}
2-
<section class="constructor">
3-
<h2>Constructor</h2>
4-
<div class="description">
2+
<section class="constructor api-section">
3+
<div class="api-section-header">
4+
<h2>Constructor</h2>
5+
</div>
6+
<div class="description api-section-content">
57
<a name="constructor" class="anchor-offset"></a>
68
<pre class="prettyprint no-bg" ng-class="{ 'anchor-focused': appCtrl.isApiDocMemberFocused('{$ doc.constructorDoc.name $}') }">
79
<code>
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
<section class="l-content-block">
2-
<h3 class="text-display-1" id="api-description">
3-
Description
4-
<a href="#api-description" class="header-link"><i class="material-icons">link</i></a>
5-
</h3>
1+
<section class="api-section">
2+
<div class="api-section-header">
3+
<h2 class="text-display-1" id="api-description">Description<a href="#api-description" class="header-link"><i class="material-icons">link</i></a></h2>
4+
</div>
5+
<div class="api-section-content">
66
{%- if doc.description.length > 2 %}
77
{$ doc.description | trimBlankLines | marked $}
88
{% endif %}
9+
</div>
910
</section>

‎aio/tools/transforms/templates/includes/_export-as.html‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{%- if doc.directiveOptions.exportAs %}
2-
<section class="export-as">
3-
<h2>Exported as</h2>
4-
<div class="description">
2+
<section class="export-as api-section">
3+
<div class="api-section-header">
4+
<h2>Exported as</h2>
5+
</div>
6+
<div class="api-section-content">
57
<p>
68
<code>{$ doc.directiveOptions.exportAs $}</code>
79
</p>

0 commit comments

Comments
 (0)