diff --git a/src/components/FunctionDefinition.js b/src/components/FunctionDefinition.js index 052b95711..6507d8cc2 100644 --- a/src/components/FunctionDefinition.js +++ b/src/components/FunctionDefinition.js @@ -1,5 +1,6 @@ import React, { Children } from 'react'; import PropTypes from 'prop-types'; +import cx from 'classnames'; import Markdown from 'react-markdown'; import styles from './FunctionDefinition.module.scss'; @@ -19,9 +20,9 @@ ParamDescription.propTypes = { children: PropTypes.node, }; -const FunctionDefinition = ({ params, returnValue }) => { +const FunctionDefinition = ({ className, params, returnValue }) => { return ( -
+
{params.length > 0 ? 'function (' : 'function ()'} @@ -48,6 +49,7 @@ const FunctionDefinition = ({ params, returnValue }) => { }; FunctionDefinition.propTypes = { + className: PropTypes.string, params: PropTypes.arrayOf( PropTypes.shape({ name: PropTypes.string, diff --git a/src/components/MethodReference.js b/src/components/MethodReference.js index 534a319e4..ecf63d9be 100644 --- a/src/components/MethodReference.js +++ b/src/components/MethodReference.js @@ -10,6 +10,7 @@ const MethodReference = ({ className, method }) => (

{method.name}

diff --git a/src/components/MethodReference.module.scss b/src/components/MethodReference.module.scss index ae4595557..033a471d0 100644 --- a/src/components/MethodReference.module.scss +++ b/src/components/MethodReference.module.scss @@ -1,15 +1,20 @@ .name { + font-family: var(--code-font); + display: inline-block; padding: 0.125rem 0.25rem; - display: inline; color: var(--color-teal-500); background: var(--color-teal-050); + margin-bottom: 1rem; } .description { - margin-top: 1rem; margin-bottom: 1rem; } .example:not(:last-child) { margin-bottom: 2rem; } + +.functionDefinition { + margin-bottom: 1rem; +} diff --git a/src/components/PropList.js b/src/components/PropList.js index e8a5bd2dd..a7b97de74 100644 --- a/src/components/PropList.js +++ b/src/components/PropList.js @@ -111,10 +111,12 @@ const PropList = ({ propTypes }) => { />
)} - + {description && ( + + )} {examples.map((example, idx) => ( diff --git a/src/templates/ApiReferenceTemplate.js b/src/templates/ApiReferenceTemplate.js index d5060b42f..b6258c32d 100644 --- a/src/templates/ApiReferenceTemplate.js +++ b/src/templates/ApiReferenceTemplate.js @@ -31,29 +31,39 @@ const ApiReferenceTemplate = ({ data }) => { {api} -
- -
+ {apiDescription && ( +
+ +
+ )}
-

Usage

+

Usage

{usage}
{methods.length > 0 && (
-

API methods

+

API methods

{methods.map((method, i) => ( - + ))}
)} {typeDefs.length > 0 && (
-

Type definitions

+

Type definitions

{typeDefs.map((typeDef, i) => ( ))} @@ -62,7 +72,7 @@ const ApiReferenceTemplate = ({ data }) => { {constants.length > 0 && (
-

Constants

+

Constants

{constants.map((constant, i) => ( ))} diff --git a/src/templates/ComponentReferenceTemplate.js b/src/templates/ComponentReferenceTemplate.js index d38cc355c..2b401671f 100644 --- a/src/templates/ComponentReferenceTemplate.js +++ b/src/templates/ComponentReferenceTemplate.js @@ -50,13 +50,15 @@ const ComponentReferenceTemplate = ({ data }) => {
+
+

Usage

+ {usage} +
+ {examples.length > 0 && (

Examples

-
- {usage} -
{examples.map((example, i) => ( {

Methods

{methods.map((method, i) => ( - + ))}
)}