How to use the @commercetools-frontend/i18n.sharedMessages.cancel function in @commercetools-frontend/i18n

To help you get started, we’ve selected a few @commercetools-frontend/i18n examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github commercetools / merchant-center-application-kit / packages / application-components / src / components / modal-pages / form-modal-page / form-modal-page.tsx View on Github external
topBarPreviousPathLabel?: Label;
  // Header Props
  subtitle?: string | React.ReactElement;
  isPrimaryButtonDisabled?: boolean;
  dataAttributesPrimaryButton?: { [key: string]: string };
  dataAttributesSecondaryButton?: { [key: string]: string };
};
type Props = CommonProps & WithCustomControls & WithoutCustomControls;
type PropsWithCustomControls = CommonProps & Required;
type PropsWithoutCustomControls = CommonProps & Required;
const defaultProps: Pick<
  Props,
  'labelPrimaryButton' | 'labelSecondaryButton'
> = {
  labelPrimaryButton: sharedMessages.confirm,
  labelSecondaryButton: sharedMessages.cancel,
};

// Type-guard validation for the correct props, based on the existence `customControls`
const hasCustomControls = (
  props: PropsWithCustomControls | PropsWithoutCustomControls
): props is PropsWithCustomControls =>
  'customControls' in props && props.customControls !== undefined;
const getConditionalProps = (props: Props) => {
  if ('customControls' in props && props.customControls !== undefined) {
    return props as PropsWithCustomControls;
  }
  return props as PropsWithoutCustomControls;
};

const FormModalPageHeaderControls = (
  props: PropsWithCustomControls | PropsWithoutCustomControls
github commercetools / merchant-center-application-kit / packages / application-components / src / components / modal-pages / tabular-modal-page / tabular-modal-page.tsx View on Github external
tabControls: React.ReactNode;
  // Header Props
  subtitle?: string | React.ReactElement;
  isPrimaryButtonDisabled?: boolean;
  dataAttributesPrimaryButton?: { [key: string]: string };
  dataAttributesSecondaryButton?: { [key: string]: string };
};
type Props = CommonProps & WithCustomControls & WithoutCustomControls;
type PropsWithCustomControls = CommonProps & Required;
type PropsWithoutCustomControls = CommonProps & Required;
const defaultProps: Pick<
  Props,
  'labelPrimaryButton' | 'labelSecondaryButton'
> = {
  labelPrimaryButton: sharedMessages.confirm,
  labelSecondaryButton: sharedMessages.cancel,
};

// Type-guard validation for the correct props, based on the existence `customControls`
const hasCustomControls = (
  props: PropsWithCustomControls | PropsWithoutCustomControls
): props is PropsWithCustomControls =>
  'customControls' in props && props.customControls !== undefined;
const getConditionalProps = (props: Props) => {
  if ('customControls' in props && props.customControls !== undefined) {
    return props as PropsWithCustomControls;
  }
  return props as PropsWithoutCustomControls;
};

const TabularModalPageHeaderControls = (
  props: PropsWithCustomControls | PropsWithoutCustomControls
github commercetools / merchant-center-application-kit / packages / application-components / src / components / dialogs / form-dialog / form-dialog.tsx View on Github external
onClose?: (event: React.SyntheticEvent) => void;
  title: string;
  size?: 'm' | 'l' | 'scale';
  zIndex?: number;
  children: React.ReactNode;
  labelSecondary: Label;
  labelPrimary: Label;
  isPrimaryButtonDisabled?: boolean;
  onSecondaryButtonClick: (event: React.SyntheticEvent) => void;
  onPrimaryButtonClick: (event: React.SyntheticEvent) => void;
  dataAttributesSecondaryButton?: { [key: string]: string };
  dataAttributesPrimaryButton?: { [key: string]: string };
  getParentSelector?: () => HTMLElement;
};
const defaultProps: Pick = {
  labelSecondary: sharedMessages.cancel,
  labelPrimary: sharedMessages.save,
};

const FormDialog = (props: Props) => (
  
    
    {props.children}
github commercetools / merchant-center-application-kit / packages / application-components / src / components / dialogs / confirmation-dialog / confirmation-dialog.tsx View on Github external
onClose?: (event: React.SyntheticEvent) => void;
  title: string;
  size?: 'm' | 'l' | 'scale';
  zIndex?: number;
  children: React.ReactNode;
  labelSecondary: Label;
  labelPrimary: Label;
  isPrimaryButtonDisabled?: boolean;
  onCancel: (event: React.SyntheticEvent) => void;
  onConfirm: (event: React.SyntheticEvent) => void;
  dataAttributesSecondaryButton?: { [key: string]: string };
  dataAttributesPrimaryButton?: { [key: string]: string };
  getParentSelector?: () => HTMLElement;
};
const defaultProps: Pick = {
  labelSecondary: sharedMessages.cancel,
  labelPrimary: sharedMessages.confirm,
};

const ConfirmationDialog = (props: Props) => (
  
    
    {props.children}

@commercetools-frontend/i18n

MC i18n messages

MIT
Latest version published 13 days ago

Package Health Score

87 / 100
Full package analysis