useComponentModifier.ts 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import type { ModalProps, PopconfirmProps } from 'naive-ui'
  2. export function useComponentModifier() {
  3. function getModalModifier(props?: ModalProps): ModalProps {
  4. const negativeButtonProps: ModalProps['negativeButtonProps'] = {
  5. ghost: false,
  6. secondary: true,
  7. type: 'tertiary',
  8. }
  9. const positiveButtonProps: ModalProps['positiveButtonProps'] = {
  10. ghost: false,
  11. secondary: true,
  12. }
  13. const themeOverrides: ModalProps['themeOverrides'] = {
  14. peers: {
  15. Dialog: {
  16. iconSize: '26px',
  17. titleFontSize: '16px',
  18. },
  19. },
  20. }
  21. return {
  22. negativeButtonProps,
  23. positiveButtonProps,
  24. themeOverrides,
  25. ...props,
  26. }
  27. }
  28. function getPopconfirmModifier(props?: PopconfirmProps): PopconfirmProps {
  29. const negativeButtonProps: PopconfirmProps['negativeButtonProps'] = {
  30. ghost: false,
  31. secondary: true,
  32. size: 'small',
  33. }
  34. const positiveButtonProps: PopconfirmProps['positiveButtonProps'] = {
  35. ghost: false,
  36. type: 'info',
  37. size: 'small',
  38. }
  39. return {
  40. negativeButtonProps,
  41. positiveButtonProps,
  42. ...props,
  43. }
  44. }
  45. return {
  46. getModalModifier,
  47. getPopconfirmModifier,
  48. }
  49. }