File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -88,6 +88,12 @@ export default factory(function Example({
8888 const isFullscreen = icache . get ( 'isFullscreen' ) ;
8989 const isCodeShowing = icache . getOrSet ( 'isCodeShowing' , true ) ;
9090
91+ let description ;
92+ if ( example . description ) {
93+ description =
94+ typeof example . description === 'string' ? example . description : < example . description /> ;
95+ }
96+
9197 return (
9298 < div >
9399 { isOverview && < div innerHTML = { widgetReadme } /> }
@@ -157,6 +163,13 @@ export default factory(function Example({
157163 </ a >
158164 </ div >
159165 ) }
166+ { description && (
167+ < virtual >
168+ < HorizontalRule />
169+ < h2 classes = "text-2xl mb-4" > Description</ h2 >
170+ { description }
171+ </ virtual >
172+ ) }
160173 { isOverview && widgetProperty && < InterfaceTable props = { widgetProperty } /> }
161174 { isOverview && widgetChildren && widgetChildren . length && (
162175 < InterfaceTable props = { widgetChildren } tableName = "Children" />
Original file line number Diff line number Diff line change @@ -8,6 +8,11 @@ import NamedClassButtonExample from './NamedClassButtonExample';
88import red from './theme/red' ;
99import blue from './theme/blue' ;
1010import InheritingButtonExample from './InheritingButtonExample' ;
11+ import { create } from '@dojo/framework/core/vdom' ;
12+
13+ const ExampleDescription = create ( ) (
14+ ( ) => 'This is an example of an optional description that is a widget.'
15+ ) ;
1116
1217export default {
1318 name : '@dojo/widgets' ,
@@ -30,7 +35,8 @@ export default {
3035 overview : {
3136 example : {
3237 filename : 'ButtonExample' ,
33- module : ButtonExample
38+ module : ButtonExample ,
39+ description : 'This is an example of an optional description that is a string.'
3440 }
3541 } ,
3642 examples : [
@@ -75,7 +81,8 @@ export default {
7581 overview : {
7682 example : {
7783 filename : 'NamedClassButtonExample' ,
78- module : NamedClassButtonExample
84+ module : NamedClassButtonExample ,
85+ description : ExampleDescription
7986 }
8087 }
8188 } ,
You can’t perform that action at this time.
0 commit comments