diff --git a/aio/src/styles/2-modules/_api-info-bar.scss b/aio/src/styles/2-modules/_api-info-bar.scss deleted file mode 100644 index 27b766bd7d..0000000000 --- a/aio/src/styles/2-modules/_api-info-bar.scss +++ /dev/null @@ -1,13 +0,0 @@ -.api-info-bar { - max-width: 800px; - text-align: left; - - span { - margin: 0 16px 0 0; - - @media screen and (max-width: 600px) { - display: block; - } - - } -} diff --git a/aio/src/styles/2-modules/_api-pages.scss b/aio/src/styles/2-modules/_api-pages.scss new file mode 100644 index 0000000000..b8e4dacfab --- /dev/null +++ b/aio/src/styles/2-modules/_api-pages.scss @@ -0,0 +1,23 @@ +.api-info-bar { + max-width: 800px; + text-align: left; + + span { + margin: 0 16px 0 0; + + @media screen and (max-width: 600px) { + display: block; + } + + } +} + +.api-heading { + margin-top: 24px; + margin-bottom: 18px; + font-size: 16px; +} + +.overloads .detail-contents { + padding-top: 0; +} diff --git a/aio/src/styles/2-modules/_details.scss b/aio/src/styles/2-modules/_details.scss new file mode 100644 index 0000000000..36a1b95714 --- /dev/null +++ b/aio/src/styles/2-modules/_details.scss @@ -0,0 +1,51 @@ +/* + * 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 + } + + &::after { + 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 + + position: absolute; + top: 12px; + right: 22px; + } +} + +details { + box-shadow: 0 1px 4px 0 rgba($black, 0.37); + + .detail-contents { + padding: 16px 24px; + } + + &[open] > summary::after { + @include rotate(180deg); // Rotate the icon + } +} diff --git a/aio/src/styles/2-modules/_modules-dir.scss b/aio/src/styles/2-modules/_modules-dir.scss index c2ac7b096c..c145331196 100644 --- a/aio/src/styles/2-modules/_modules-dir.scss +++ b/aio/src/styles/2-modules/_modules-dir.scss @@ -3,7 +3,7 @@ ============================== */ @import 'alert'; - @import 'api-info-bar'; + @import 'api-pages'; @import 'api-list'; @import 'banner'; @import 'buttons'; @@ -12,6 +12,7 @@ @import 'code'; @import 'contribute'; @import 'contributor'; + @import 'details'; @import 'edit-page-cta'; @import 'features'; @import 'filetree'; diff --git a/aio/tools/transforms/templates/api/function.template.html b/aio/tools/transforms/templates/api/function.template.html index fd86241011..5eb2d6dfb4 100644 --- a/aio/tools/transforms/templates/api/function.template.html +++ b/aio/tools/transforms/templates/api/function.template.html @@ -2,15 +2,14 @@ {% extends 'export-base.template.html' -%} {% block details %} -{% if doc.overloads.length === 1 %} - - function {$ doc.overloads[0].name $}{$ params.paramList(doc.overloads[0].parameters) $} - {%- if doc.overloads[0].type %}: {$ doc.overloads[0].type | escape $}{% endif %}; - - {% include "includes/description.html" %} -{% else %} + +function {$ doc.name $}{$ params.paramList(doc.parameters) $} +{%- if doc.type %}: {$ doc.type | escape $}{% endif %}; + +{% include "includes/description.html" %} +{% if doc.overloads.length %}

Overloads

{% for overload in doc.overloads %} - + function {$ overload.name $}{$ params.paramList(overload.parameters) $} {%- if overload.type %}: {$ overload.type | escape $}{% endif %}; diff --git a/aio/tools/transforms/templates/api/includes/constructor.html b/aio/tools/transforms/templates/api/includes/constructor.html index c291786b48..85ea15082b 100644 --- a/aio/tools/transforms/templates/api/includes/constructor.html +++ b/aio/tools/transforms/templates/api/includes/constructor.html @@ -2,7 +2,7 @@

Constructor

- {$ doc.constructorDoc.name $}{$ params.paramList(doc.constructorDoc.parameters) $} + {$ doc.constructorDoc.name $}{$ params.paramList(doc.constructorDoc.parameters) $} {% if not doc.constructorDoc.notYetDocumented %}{$ doc.constructorDoc.description | marked $}{% endif %}
{% endif %} diff --git a/aio/tools/transforms/templates/api/lib/memberHelpers.html b/aio/tools/transforms/templates/api/lib/memberHelpers.html index 5fcb26752a..a6887f98f5 100644 --- a/aio/tools/transforms/templates/api/lib/memberHelpers.html +++ b/aio/tools/transforms/templates/api/lib/memberHelpers.html @@ -22,7 +22,7 @@ {%- macro renderMemberDetail(member, cssClass) -%}
- {$ renderMember(member) $} + {$ renderMember(member) $} {%- if not member.notYetDocumented %} {$ member.description | marked $} {% endif -%} @@ -35,7 +35,17 @@

{$ titleText $}

{% for member in members %}{% if not member.internal %} {$ renderMemberDetail(member, itemClass) $} - {% if not loop.last %}
{% endif %} + {% if member.overloads.length %} +
+ Overloads +
+ {% for overload in member.overloads %} + {$ renderMemberDetail(overload, itemClass + '-overload') $} + {% endfor %} +
+
+ {% endif %} + {% if not loop.last %}
{% endif %} {% endif %}{% endfor %} {% endif %} diff --git a/aio/tools/transforms/templates/api/var.template.html b/aio/tools/transforms/templates/api/var.template.html index c543567d24..397c3f4a28 100644 --- a/aio/tools/transforms/templates/api/var.template.html +++ b/aio/tools/transforms/templates/api/var.template.html @@ -1,7 +1,7 @@ {% extends 'export-base.template.html' %} {% block details %} - + const {$ doc.name $}: {$ doc.symbolTypeName or 'any' $}; {% include "includes/description.html" %}