File tree Expand file tree Collapse file tree 2 files changed +36
-4
lines changed
Expand file tree Collapse file tree 2 files changed +36
-4
lines changed Original file line number Diff line number Diff line change 11import React from 'react' ;
22import merge from 'merge' ;
33
4+ import { bemClasses } from '../../helpers' ;
45import { TypeWithKey , Schema } from '../../types' ;
56import {
67 Markdown ,
@@ -45,12 +46,32 @@ const schemaPropertiesAccessors: Array<TableAccessor<SchemaElement>> = [
4546 ) ,
4647 el => < span > { el . schema . content . format } </ span > ,
4748 el => < span > { el . schema . content . default } </ span > ,
48- el =>
49- el . schema . content . description && (
50- < Markdown > { el . schema . content . description } </ Markdown >
51- ) ,
49+ el => {
50+ const enumElements = getEnumHTMLElements ( el . schema ) ;
51+ return (
52+ el . schema . content . description && (
53+ < div >
54+ < Markdown > { el . schema . content . description } </ Markdown >
55+ { enumElements . length > 0 && < div > Enum: { enumElements } </ div > }
56+ </ div >
57+ )
58+ ) ;
59+ } ,
5260] ;
5361
62+ const getEnumHTMLElements = ( schema : SchemaWithKey ) : HTMLElement [ ] => {
63+ let enumElements : any [ ] = [ ] ;
64+ if ( schema . content . enum && schema . content . enum . length ) {
65+ enumElements = schema . content . enum . map ( ( value : any , i : number ) => (
66+ < span className = { bemClasses . element ( `enum` ) } key = { i } >
67+ "{ value } "
68+ </ span >
69+ ) ) ;
70+ }
71+
72+ return enumElements ;
73+ } ;
74+
5475const handleNotProperty = ( prop : Schema ) : Schema => {
5576 if ( prop . not ) {
5677 const arrayOfChangedObjects = Object . entries ( prop ) . map ( ( [ key , val ] ) => {
Original file line number Diff line number Diff line change 12441244 font-family : monospace;
12451245 display : block;
12461246}
1247+
1248+ .asyncapi__enum {
1249+ line-height : 2 ;
1250+ border-style : solid;
1251+ border-color : # dae1e7 ;
1252+ border-radius : 0.25rem ;
1253+ border-width : 1px ;
1254+ margin-left : 0.25rem ;
1255+ padding : 0 0.5rem ;
1256+ color : # f6993f ;
1257+ }
You can’t perform that action at this time.
0 commit comments