How to use the @commercetools-frontend/constants.NOTIFICATION_DOMAINS.SIDE function in @commercetools-frontend/constants

To help you get started, we’ve selected a few @commercetools-frontend/constants 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 / react-notifications / src / components / notifications-list / notifications-list.spec.tsx View on Github external
beforeEach(() => {
        mocked(useSelector).mockClear();
        mocked(useSelector).mockReturnValue([
          {
            id: 1,
            domain: NOTIFICATION_DOMAINS.SIDE,
            kind: NOTIFICATION_KINDS_SIDE.error,
            text: 'Something went wrong',
          },
        ]);
        rendered = renderComponent(
          
        );
      });
      it('should render the GenericNotification notification component', async () => {
github commercetools / merchant-center-application-kit / packages / react-notifications / src / components / notifier / notifier.spec.tsx View on Github external
it('should dispatch notification when component renders, then remove the notification when component is removed', async () => {
    rendered = render(
      
        
      
    );
    await waitForElement(() => rendered.getByText('Open'));
    fireEvent.click(rendered.getByText('Open'));

    await wait(() => {
      expect(showNotification).toHaveBeenCalledWith(
        expect.objectContaining({
          domain: NOTIFICATION_DOMAINS.SIDE,
          kind: NOTIFICATION_KINDS_SIDE.success,
          text: 'foo',
        }),
        undefined
github commercetools / merchant-center-application-kit / packages / react-notifications / src / components / notifier / notifier.spec.tsx View on Github external
await wait(() => {
      expect(showNotification).toHaveBeenCalledWith(
        expect.objectContaining({
          domain: NOTIFICATION_DOMAINS.SIDE,
          kind: NOTIFICATION_KINDS_SIDE.success,
          text: 'foo',
        }),
        undefined
      );
      expect(dismiss).not.toHaveBeenCalled();
    });
github commercetools / merchant-center-application-kit / packages / react-notifications / src / components / notifications-list / notifications-list.spec.tsx View on Github external
beforeEach(() => {
        mocked(useSelector).mockClear();
        mocked(useSelector).mockReturnValue([
          {
            id: 1,
            domain: NOTIFICATION_DOMAINS.SIDE,
            kind: NOTIFICATION_KINDS_SIDE.error,
            text: 'Something went wrong',
          },
        ]);
        rendered = renderComponent(
          
        );
      });
      it('should render the GenericNotification notification component', async () => {
github commercetools / merchant-center-application-kit / packages / react-notifications / src / components / notification / notification.spec.tsx View on Github external
const createTestProps = (
  props: Partial = {}
) => ({
  children: ,
  domain: NOTIFICATION_DOMAINS.SIDE,
  type: NOTIFICATION_KINDS_SIDE.warning,
  onCloseClick: jest.fn(),
  ...props,
});
github commercetools / merchant-center-application-kit / packages / react-notifications / src / components / notifications-list / notifications-list.tsx View on Github external
const NotificationsList = (props: Props) => {
  switch (props.domain) {
    case NOTIFICATION_DOMAINS.GLOBAL:
      return ;
    case NOTIFICATION_DOMAINS.PAGE:
      return ;
    case NOTIFICATION_DOMAINS.SIDE:
      return ;
    default:
      return null;
  }
};
NotificationsList.displayName = 'NotificationsList';
github commercetools / merchant-center-application-kit / packages / react-notifications / src / components / notification / notification.styles.ts View on Github external
const getStylesForContent = (props: StyleProps) => {
  const fontColor =
    props.domain === NOTIFICATION_DOMAINS.SIDE
      ? customProperties.colorSolid
      : customProperties.colorSurface;
  return css`
    flex-basis: 100%;
    flex-grow: 1;
    padding: 0 ${customProperties.spacingS};
    margin: 0;
    font-size: ${props.domain === NOTIFICATION_DOMAINS.SIDE
      ? '0.929rem'
      : 'inherit'};

    color: ${fontColor};

    p,
    a {
      color: ${fontColor};
    }
    ul {
      padding: 0;
      margin: 0;
      list-style: none;
    }
  `;
};
github commercetools / merchant-center-application-kit / packages / react-notifications / src / components / notifications-list / notifications-list.styles.ts View on Github external
width: 100%;
    z-index: 10000;
  `;

  switch (props.domain) {
    case NOTIFICATION_DOMAINS.GLOBAL:
      return css`
        ${baseStyles};
        text-align: center;
        width: 100% !important;
      `;
    case NOTIFICATION_DOMAINS.PAGE:
      return css`
        ${baseStyles};
      `;
    case NOTIFICATION_DOMAINS.SIDE:
      return css`
        ${baseStyles};
        position: absolute;
        text-align: left;
        height: 0;
        overflow: visible;
      `;
    default:
      return css``;
  }
};
github commercetools / merchant-center-application-kit / packages / react-notifications / src / components / notification / notification.styles.ts View on Github external
const getStylesForContent = (props: StyleProps) => {
  const fontColor =
    props.domain === NOTIFICATION_DOMAINS.SIDE
      ? customProperties.colorSolid
      : customProperties.colorSurface;
  return css`
    flex-basis: 100%;
    flex-grow: 1;
    padding: 0 ${customProperties.spacingS};
    margin: 0;
    font-size: ${props.domain === NOTIFICATION_DOMAINS.SIDE
      ? '0.929rem'
      : 'inherit'};

    color: ${fontColor};

    p,
    a {
      color: ${fontColor};
github commercetools / merchant-center-application-kit / packages / react-notifications / src / components / notification / notification.tsx View on Github external
const Notification = (props: Props) => {
  const intl = useIntl();
  return (
    <div>
      <div>{props.children}</div>
      {props.onCloseClick ? (
        <div>
          }
            size="medium"
          /&gt;
        </div>
      ) : null}
      {props.domain === NOTIFICATION_DOMAINS.SIDE ? (
        <div>
          
        </div>
      ) : null}
    </div>
  );
};
Notification.displayName = 'Notification';

@commercetools-frontend/constants

Shared constants for MC applications

MIT
Latest version published 3 days ago

Package Health Score

87 / 100
Full package analysis