-
Notifications
You must be signed in to change notification settings - Fork 841
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4470046
commit e4d9182
Showing
2 changed files
with
80 additions
and
0 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
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,78 @@ | ||
import { PropTypes } from 'react-view'; | ||
import { | ||
EuiKeyPadMenuItem, | ||
EuiIcon, | ||
EuiBetaBadge, | ||
} from '../../../../src/components/'; | ||
import { | ||
propUtilityForPlayground, | ||
iconValidator, | ||
} from '../../services/playground'; | ||
import * as t from '@babel/types'; | ||
|
||
export const keyPadMenuItemConfig = () => { | ||
const docgenInfo = Array.isArray(EuiKeyPadMenuItem.__docgenInfo) | ||
? EuiKeyPadMenuItem.__docgenInfo[0] | ||
: EuiKeyPadMenuItem.__docgenInfo; | ||
const propsToUse = propUtilityForPlayground(docgenInfo.props); | ||
|
||
propsToUse.onClick = { | ||
...propsToUse.onClick, | ||
type: PropTypes.Custom, | ||
value: undefined, | ||
custom: { | ||
...propsToUse.onClick.custom, | ||
use: 'switch', | ||
label: 'Simulate', | ||
}, | ||
}; | ||
propsToUse.label = { | ||
...propsToUse.label, | ||
type: PropTypes.String, | ||
value: 'Label', | ||
}; | ||
|
||
propsToUse.betaBadgeTooltipContent = { | ||
...propsToUse.betaBadgeTooltipContent, | ||
type: PropTypes.String, | ||
}; | ||
|
||
propsToUse.betaBadgeIconType = iconValidator(propsToUse.betaBadgeIconType); | ||
|
||
propsToUse.children = { | ||
...propsToUse.children, | ||
type: PropTypes.ReactNode, | ||
value: '<EuiIcon type="dashboardApp" size="l" />', | ||
hidden: false, | ||
}; | ||
|
||
return { | ||
config: { | ||
componentName: 'EuiKeyPadMenuItem', | ||
props: propsToUse, | ||
scope: { | ||
EuiKeyPadMenuItem, | ||
EuiIcon, | ||
EuiBetaBadge, | ||
}, | ||
imports: { | ||
'@elastic/eui': { | ||
named: ['EuiKeyPadMenuItem', 'EuiIcon', 'EuiBetaBadge'], | ||
}, | ||
}, | ||
customProps: { | ||
onClick: { | ||
generate: val => { | ||
if (!val) return null; | ||
const obj = t.arrowFunctionExpression( | ||
[], | ||
t.blockStatement([]), | ||
false | ||
); | ||
return obj; | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; | ||
}; |