From 8dfcc78c08037cced77a523d89251b814849fadb Mon Sep 17 00:00:00 2001 From: Stefanie Fluin Date: Wed, 18 Jul 2018 11:34:59 -0700 Subject: [PATCH] docs(aio): api page cleanup --- aio/src/styles/1-layouts/_api-pages.scss | 221 +++++++++++++++++- aio/src/styles/2-modules/_api-pages.scss | 114 --------- aio/src/styles/2-modules/_details.scss | 48 ---- aio/src/styles/2-modules/_hr.scss | 9 - aio/src/styles/2-modules/_modules-dir.scss | 2 - .../templates/api/base.template.html | 28 +-- .../templates/api/lib/githubLinks.html | 2 +- .../templates/api/lib/memberHelpers.html | 28 ++- 8 files changed, 254 insertions(+), 198 deletions(-) delete mode 100644 aio/src/styles/2-modules/_api-pages.scss delete mode 100644 aio/src/styles/2-modules/_details.scss diff --git a/aio/src/styles/1-layouts/_api-pages.scss b/aio/src/styles/1-layouts/_api-pages.scss index a819b1192f..b6fae773ef 100644 --- a/aio/src/styles/1-layouts/_api-pages.scss +++ b/aio/src/styles/1-layouts/_api-pages.scss @@ -1,5 +1,4 @@ .api-body { - max-width: 1200px; table { @@ -19,6 +18,12 @@ vertical-align: middle; } + tbody > tr > td tr td:first-child { + @media screen and (max-width: 480px) { + background-color: inherit; + } + } + hr { margin: 16px 0; } @@ -42,5 +47,217 @@ .short-description { margin-left: 0; } + + &.parameters-table { + margin-top: 0; + font-size: 14px; + box-shadow: none; + + tr { + border: 0; + + @media screen and (max-width: 480px) { + display: flex; + flex-direction: column; + } + + td:first-child { + font-weight: 600; + } + } + + td { + padding: 8px 8px 8px 0; + border: 0; + vertical-align: top; + } + + td:nth-child(1) { + width: 20%; + } + } } -} \ No newline at end of file + + .class-overview { + position: relative; + + code-example { + clear: left; + } + } + + .icon-action-header { + display: flex; + flex-direction: row; + align-items: center; + justify-content: space-between; + } + + .method-table th { + display: flex; + } + + .method-table, .option-table { + th { + + .action-icons { + a { + color: $mediumgray; + + .material-icons:hover { + background: none; + color: $blue; + } + } + } + } + + h3 { + margin: 6px 0; + font-weight: bold; + clear: left; + } + + h4 { + font-size: 14px; + font-weight: bold; + margin-top: 12px; + } + } + + .api-heading { + padding: 5px 0; + font-size: 14px; + font-weight: bold; + } + + .short-description { + margin: 6px 0 0 10px; + } + + .properties-table { + font-size: 14px; + + thead th { + &:nth-child(1) { + width: 20%; + } + &:nth-child(2) { + width: 20%; + } + } + } + + details.overloads { + box-shadow: none; + + .icon-action-header a { + display: flex; + } + + .detail-contents { + padding: 0; + border: 1px solid $lightgray; + border-radius: 2px; + box-shadow: none; + + > *:not(hr) { + margin: 16px 24px; + } + } + + summary { + height: inherit; + padding: 0 8px 8px; + + h4 { + margin: 0; + } + } + + table { + &.is-full-width { + width: auto; + } + } + } + + .from-constructor, .read-only-property { + font-size: 12px; + font-weight: 600; + letter-spacing: 0.5px; + font-style: italic; + background-color: $lightgray; + border-radius: 4px; + padding: 4px 6px; + } +} + +.breadcrumb-container { + display: flex; + flex-direction: row; + justify-content: space-between; +} + +.github-links { + .material-icons { + border-radius: 4px; + padding: 4px; + font-size: 20px; + &:hover { + background-color: $mist; + } + } +} + +.api-header { + display: flex; + align-items: center; + + @media screen and (max-width: 600px) { + flex-direction: column; + align-items: flex-start; + } +} + +// ____________________________________________ + +/* + * General styling to make detail/summary tags look a bit more material + * To get the best out of it you should structure your usage like this: + * + * ``` + *
+ * Some title + *
+ * Some content + *
+ *
+ * + */ + + summary { + cursor: pointer; + font-size: 16px; + position: relative; + padding: 16px 24px; + color: $black; + height: 16px; + display: block; // Remove the built in details marker in FF + + &::-webkit-details-marker { + display: none; // Remove the built in details marker in webkit + } +} + +details { + box-shadow: 0 1px 4px 0 rgba($black, 0.37); + + .detail-contents { + padding: 16px 24px; + } + + &[open] > i.material-icons { + @include rotate(180deg); // Rotate the icon + } +} diff --git a/aio/src/styles/2-modules/_api-pages.scss b/aio/src/styles/2-modules/_api-pages.scss deleted file mode 100644 index 41768a0bd9..0000000000 --- a/aio/src/styles/2-modules/_api-pages.scss +++ /dev/null @@ -1,114 +0,0 @@ -.github-links { - float: right; - .material-icons { - border-radius: 4px; - padding: 4px; - font-size: 20px; - &:hover { - background-color: $mist; - } - } -} - -.api-header { - display: flex; - align-items: center; - - @media screen and (max-width: 600px) { - flex-direction: column; - align-items: flex-start; - } -} - -.api-body { - - .class-overview { - position: relative; - - code-example { - clear: left; - } - } - - .method-table, .option-table, .list-table { - th { - display: flex; - align-items: center; - - h3 { - flex: 1; - } - - .github-links { - a { - color: $mediumgray; - .material-icons:hover { - background: none; - color: $blue; - } - } - } - } - - h3 { - margin: 6px 0; - font-weight: bold; - clear: left; - } - - h4 { - font-size: 14px; - font-weight: bold; - margin-top: 12px; - } - } - - .api-heading { - padding: 5px 0; - font-size: 16px; - font-weight: bold; - } - - .short-description { - margin: 6px 0 0 10px; - } - - .properties-table { - font-size: 14px; - - thead th { - &:nth-child(1) { - width: 20%; - } - &:nth-child(2) { - width: 20%; - } - } - } - - .parameters-table { - margin-top: 0; - font-size: 14px; - td:nth-child(1) { - width: 20%; - } - } - - details.overloads { - margin-left: -8px; - - summary { - height: inherit; - padding: 8px 12px; - h4 { - margin: 0; - clear: left; - } - } -} - - .from-constructor, .read-only-property { - font-style: italic; - color: $blue; - } -} diff --git a/aio/src/styles/2-modules/_details.scss b/aio/src/styles/2-modules/_details.scss deleted file mode 100644 index 32728d8026..0000000000 --- a/aio/src/styles/2-modules/_details.scss +++ /dev/null @@ -1,48 +0,0 @@ -/* - * General styling to make detail/summary tags look a bit more material - * To get the best out of it you should structure your usage like this: - * - * ``` - *
- * Some title - *
- * Some content - *
- *
- * - */ - -summary { - cursor: pointer; - font-size: 16px; - position: relative; - padding: 16px 24px; - color: $black; - height: 16px; - display: block; // Remove the built in details marker in FF - - &::-webkit-details-marker { - display: none; // Remove the built in details marker in webkit - } - - &::before { - content: '\E5CE'; // See https://material.io/icons/#ic_expand_less - font-family: 'Material Icons'; - font-size: 24px; - -webkit-font-smoothing: antialiased; - @include rotate(0deg); // We will rotate 180 degrees when details is open - float: right; - } -} - -details { - box-shadow: 0 1px 4px 0 rgba($black, 0.37); - - .detail-contents { - padding: 16px 24px; - } - - &[open] > summary::before { - @include rotate(180deg); // Rotate the icon - } -} diff --git a/aio/src/styles/2-modules/_hr.scss b/aio/src/styles/2-modules/_hr.scss index eacfad9b2d..6f02629450 100644 --- a/aio/src/styles/2-modules/_hr.scss +++ b/aio/src/styles/2-modules/_hr.scss @@ -3,12 +3,3 @@ hr { background: $lightgray; height: 1px; } - -.hr-margin { - display: block; - height: 1px; - border: 0; - margin-top: 16px; - margin-bottom: 16px; - padding: 0; -} \ No newline at end of file diff --git a/aio/src/styles/2-modules/_modules-dir.scss b/aio/src/styles/2-modules/_modules-dir.scss index 1bb94dc4fb..6ae78c8216 100644 --- a/aio/src/styles/2-modules/_modules-dir.scss +++ b/aio/src/styles/2-modules/_modules-dir.scss @@ -3,7 +3,6 @@ ============================== */ @import 'alert'; - @import 'api-pages'; @import 'api-list'; @import 'buttons'; @import 'callout'; @@ -11,7 +10,6 @@ @import 'code'; @import 'contribute'; @import 'contributor'; - @import 'details'; @import 'edit-page-cta'; @import 'features'; @import 'filetree'; diff --git a/aio/tools/transforms/templates/api/base.template.html b/aio/tools/transforms/templates/api/base.template.html index 72b6fe9a7a..6953ba09e3 100644 --- a/aio/tools/transforms/templates/api/base.template.html +++ b/aio/tools/transforms/templates/api/base.template.html @@ -2,19 +2,21 @@ {% set comma = joiner(',') %} {% set slash = joiner('/') %}
- {$ github.githubLinks(doc, versionInfo) $} - -{%- endmacro -%} \ No newline at end of file +{%- endmacro -%} diff --git a/aio/tools/transforms/templates/api/lib/memberHelpers.html b/aio/tools/transforms/templates/api/lib/memberHelpers.html index de81f1f5a2..57f29f3757 100644 --- a/aio/tools/transforms/templates/api/lib/memberHelpers.html +++ b/aio/tools/transforms/templates/api/lib/memberHelpers.html @@ -47,17 +47,17 @@ {$ renderMemberSyntax(overload) $} -

Parameters

+
Parameters
{$ params.renderParameters(overload.parameterDocs, cssClass + '-parameters', cssClass + '-parameter') $} {% if overload.type or overload.returns.type %} -

Returns

+
Returns
{% marked %}`{$ (overload.type or overload.returns.type) $}`{% if overload.returns %}: {$ overload.returns.description $}{% endif %}{% endmarked %} {% endif %} {% if overload.throws.length %} -

Throws

+
Throws
{% for error in overload.throws %} {% marked %}`{$ (error.typeList or 'Error') $}` {$ error.description $}{% endmarked %} {% endfor %} @@ -73,7 +73,7 @@ {%- macro renderMethodDetail(versionInfo, method, cssClass) -%} - {% if method.name !== 'constructor' %} @@ -170,10 +180,10 @@ {% if hasTypes %}{% endif %} {% endfor %}
+ {% if method.name !== 'constructor' %}

{% if method.isCallMember %}call signature {% elseif method.isNewMember %}construct signature @@ -106,12 +106,22 @@

-

{$ method.overloads.length $} overloads...

+ +
+

Overloads

+ Show All expand_more +
+
- {% for overload in method.overloads %} + {% for overload in method.overloads %} +
+
+ Overload #_ of {$ method.overloads.length $} + expand_more
{$ renderOverloadInfo(overload, cssClass + '-overload', method) $} - {% if not loop.last %}
{% endif %} + {% if not loop.last %}
{% endif %} {% endfor %} +
{$ property.name $} - {%- if (property.isGetAccessor or property.isReadonly) and not property.isSetAccessor %}Read-only.{% endif %} + {%- if (property.isGetAccessor or property.isReadonly) and not property.isSetAccessor %}Read Only{% endif %} {% if property.shortDescription %}{$ property.shortDescription | marked $}{% endif %} {$ (property.description or property.constructorParamDoc.description) | marked $} - {% if property.constructorParamDoc %} Declared in constructor.{% endif %} + {% if property.constructorParamDoc %} Declared in Constructor{% endif %}