-
Notifications
You must be signed in to change notification settings - Fork 842
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [Playground] EuiAccordion * created dummyFunction utility * replaced all instances with dummyFunction
- Loading branch information
1 parent
0795692
commit 9706799
Showing
8 changed files
with
88 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import * as t from '@babel/types'; | ||
|
||
export const dummyFunction = { | ||
generate: val => { | ||
if (!val) return null; | ||
const obj = t.arrowFunctionExpression([], t.blockStatement([]), false); | ||
return obj; | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { PropTypes } from 'react-view'; | ||
import { EuiAccordion, EuiText } from '../../../../src/components/'; | ||
import { | ||
propUtilityForPlayground, | ||
createOptionalEnum, | ||
dummyFunction, | ||
} from '../../services/playground'; | ||
|
||
export const accordionConfig = () => { | ||
const docgenInfo = Array.isArray(EuiAccordion.__docgenInfo) | ||
? EuiAccordion.__docgenInfo[0] | ||
: EuiAccordion.__docgenInfo; | ||
const propsToUse = propUtilityForPlayground(docgenInfo.props); | ||
|
||
propsToUse.buttonContent = { | ||
...propsToUse.buttonContent, | ||
value: 'Click me to toggle', | ||
type: PropTypes.String, | ||
}; | ||
|
||
propsToUse.children = { | ||
value: `<EuiText> | ||
<p> | ||
Any content inside of <strong>EuiAccordion</strong> will appear here. | ||
</p> | ||
</EuiText>`, | ||
type: PropTypes.ReactNode, | ||
hidden: false, | ||
}; | ||
|
||
propsToUse.onToggle = { | ||
...propsToUse.onToggle, | ||
type: PropTypes.Custom, | ||
value: undefined, | ||
custom: { | ||
use: 'switch', | ||
label: 'Simulate', | ||
}, | ||
}; | ||
|
||
propsToUse.forceState = createOptionalEnum(propsToUse.forceState); | ||
|
||
return { | ||
config: { | ||
componentName: 'EuiAccordion', | ||
props: propsToUse, | ||
scope: { | ||
EuiAccordion, | ||
EuiText, | ||
}, | ||
imports: { | ||
'@elastic/eui': { | ||
named: ['EuiAccordion', 'EuiText'], | ||
}, | ||
}, | ||
customProps: { | ||
onToggle: dummyFunction, | ||
}, | ||
}, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters