New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@n3/react-remove-button

Package Overview
Dependencies
Maintainers
5
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@n3/react-remove-button

Remove button component for react applications based on @n3/kit

latest
npmnpm
Version
0.2.0
Version published
Maintainers
5
Created
Source

@n3/react-remove-button

Кнопка удаления для приложений на базе @n3/kit.

import {
  RemoveButton,
} from '@n3/react-remove-button';

Props

НазваниеОбязательностьТипЗначение по умолчаниюОписание
colorenum
- buttonColors.DEFAULT
- buttonColors.PRIMARY
- buttonColors.TERTIARY
- buttonColors.DANGER
undefinedЦвет кнопки
sizeenum
- buttonSizes.DEFAULT
- buttonSizes.SMALL
undefinedРазмер кнопки
disabledboolfalseВыключена ли кнопка
children+node
remove+funcАсинхронная функция удаления
onRemoveSuccessfuncundefinedОбработчик успешного удаления
approveTitlenodeundefinedЗаголовок подтверждения
approveContentnodeundefinedТекст подтверждения
approveButtonText+stringТекст кнопки подтвеждения
approveButtonColorenum
- buttonColors.DEFAULT
- buttonColors.PRIMARY
- buttonColors.TERTIARY
- buttonColors.DANGER
buttonColors.DANGERЦвет кнопки подтверждения
cancelButtonText+stringТекст кнопки отмены
errorsPathstring'response.data.detail'Путь до объекта ошибкок в случае ошибки удаления
redirectToanyundefinedАдрес редиректа в случае успешного удаления
notificationobjectundefinedСообщение @n3/browser-messages в случае успешного удаления

Создание кастомной кнопки удаления

import type {
  FC,
  ReactNode,
} from 'react';
import {
  useRemoveButton,
} from '@n3/react-remove-button';
import type {
  UseRemoveButtonParams,
} from '@n3/react-remove-button';

type CustomRemoveButtonProps = UseRemoveButtonParams & {
  children?: ReactNode;
};

const CustomRemoveButton: FC<CustomRemoveButtonProps> = (props) => {
  const {
    children,
    remove,
    onRemoveSuccess,
    approveTitle,
    approveContent,
    approveButtonText,
    approveButtonColor,
    cancelButtonText,
    errorsPath,
    redirectTo,
    notification,
  } = props;

  const {
    isRemoving,
    onClick,
  } = useRemoveButton({
    remove,
    onRemoveSuccess,
    approveTitle,
    approveContent,
    approveButtonText,
    approveButtonColor,
    cancelButtonText,
    errorsPath,
    redirectTo,
    notification,
  });

  return (
    <button
      type="button"
      disabled={isRemoving}
      onClick={onClick}
    >
      {children}
    </button>
  );
};

FAQs

Package last updated on 26 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts