您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

ContextMenuItemGroup.js 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // @flow
  2. import { makeStyles } from '@material-ui/core';
  3. import React from 'react';
  4. import ContextMenuItem from './ContextMenuItem';
  5. type Props = {
  6. /**
  7. * List of actions in this group.
  8. */
  9. actions?: Array<Object>,
  10. /**
  11. * The children of the component.
  12. */
  13. children?: React$Node,
  14. };
  15. const useStyles = makeStyles(theme => {
  16. return {
  17. contextMenuItemGroup: {
  18. '&:not(:empty)': {
  19. padding: `${theme.spacing(2)}px 0`
  20. },
  21. '& + &:not(:empty)': {
  22. borderTop: `1px solid ${theme.palette.ui04}`
  23. }
  24. }
  25. };
  26. });
  27. const ContextMenuItemGroup = ({
  28. actions,
  29. children
  30. }: Props) => {
  31. const styles = useStyles();
  32. return (
  33. <div className = { styles.contextMenuItemGroup }>
  34. {children}
  35. {actions && actions.map(actionProps => (
  36. <ContextMenuItem
  37. key = { actionProps.text }
  38. { ...actionProps } />
  39. ))}
  40. </div>
  41. );
  42. };
  43. export default ContextMenuItemGroup;