File tree Expand file tree Collapse file tree 1 file changed +35
-7
lines changed
Expand file tree Collapse file tree 1 file changed +35
-7
lines changed Original file line number Diff line number Diff line change @@ -2,13 +2,40 @@ import React from "react";
22
33import styles from "./styles.module.css" ;
44
5- export const Function = ( { since, children } ) =>
6- ( since && (
7- < >
8- < span className = { styles . sinceBlock } > Available since: { since } </ span >
9- < div className = { styles . function } > { children } </ div >
10- </ >
11- ) ) || < > </ > ;
5+ class Function extends React . Component {
6+ render ( ) {
7+ const since = this . props . since ;
8+ const children = this . props . children ;
9+
10+ const isRunningInDevelopmentMode = process . env . NODE_ENV !== "production" ;
11+ if ( isRunningInDevelopmentMode ) {
12+ // Doesn't look like more context can easily be obtained, so let's leave it at that...
13+ const where = location ;
14+ const what = `Missing property (since) for (Function) imported from ${ where } ` ;
15+ const message = `${ what } ` ;
16+ if ( ! since ) throw new Error ( message ) ;
17+ }
18+
19+ const sinceBlock = ( since && (
20+ < >
21+ < span className = { styles . sinceBlock } > Available since: { since } </ span >
22+ </ >
23+ ) ) || (
24+ < >
25+ < span className = { styles . sinceBlock } >
26+ Available since: ¯\_(ツ)_/¯ (Missing availability data - sorry about
27+ that)
28+ </ span >
29+ </ >
30+ ) ;
31+ return (
32+ < >
33+ { sinceBlock }
34+ < div className = { styles . function } > { children } </ div >
35+ </ >
36+ ) ;
37+ }
38+ }
1239
1340class NilableInfo extends React . Component {
1441 render ( ) {
@@ -346,6 +373,7 @@ class Blocking extends React.Component {
346373}
347374
348375export {
376+ Function ,
349377 Parameters ,
350378 Parameter ,
351379 Returns ,
You can’t perform that action at this time.
0 commit comments