@@ -11,6 +11,14 @@ import { DocsContainer } from '@storybook/addon-docs';
1111
1212// export const decorators = [cssVariablesTheme]
1313
14+ function cleanHtmlString ( htmlString ) {
15+ // Remove the leading and trailing backticks and braces
16+ if ( htmlString . startsWith ( '{`' ) && htmlString . endsWith ( '`}' ) ) {
17+ htmlString = htmlString . slice ( 2 , - 2 ) ;
18+ }
19+ return htmlString ;
20+ }
21+
1422export const decorators = [
1523 ( Story , context ) => {
1624 useEffect ( ( ) => {
@@ -28,15 +36,6 @@ export const decorators = [
2836] ;
2937
3038export const parameters = {
31- // actions: { argTypesRegex: '^on[A-Z].*' },
32- // cssVariables: {
33- // files: {
34- // 'HSE theme': hseTheme,
35- // 'AGS theme': agsTheme,
36- // 'OGCIO theme': defaultTheme,
37- // },
38- // defaultTheme: 'OGCIO theme',
39- // },
4039 controls : {
4140 matchers : {
4241 color : / ( b a c k g r o u n d | c o l o r ) $ / i,
@@ -45,12 +44,13 @@ export const parameters = {
4544 sort : 'requiredFirst' ,
4645 } ,
4746 docs : {
48- source : { format : false } ,
47+ source : {
48+ transform : ( code ) => {
49+ // Work around solution to remove extra parenthesis like ` and {}
50+ return cleanHtmlString ( code ) ;
51+ } ,
52+ } ,
4953 container : ( { children, context } ) => {
50- // let newContext;
51- // cssVariablesTheme((c) => (newContext = c), context);
52- // <DocsContainer context={newContext}>
53-
5454 return (
5555 < DocsContainer context = { context } >
5656 < div className = "sb-unstyled" > { children } </ div >
0 commit comments