Parafia Skoczów
  • 👋Witaj w Parafii Skoczów
  • O APLIKACJI
    • ✨Funkcjonalności
    • 📷Galeria
    • 🛠️Zarządzanie treściami
  • DLA PROGRAMISTÓW
    • 🏗️Przegląd narzędzi
    • ⛪Parafia Skoczów
      • Assets
      • Components
        • Atoms
        • Molecules
        • Organisms
        • Templates
      • Helpers
        • getAnimationProps
        • getData
        • getTransmissionUrl
        • searchContent
        • useModal
      • Hooks
        • useDisablePinchZoom
        • usePinching
        • useSwipe
      • Providers
        • ContentProvider
        • FirebaseProvider
        • PlaylistProvider
      • Utils
      • Views
        • Home
        • Categories
        • Titles
        • Text
        • Playlist
        • Search
      • Cordova
      • Rozwiązywanie problemów
    • 🎶Playlist Maker
      • Assets
      • Components
        • Atoms
        • Molecules
        • Organisms
        • Templates
      • Helpers
      • Hooks
        • useDnd
        • useEdit
        • useName
        • useModal
      • Providers
        • ContentProvider
        • FirebaseProvider
        • NotificationProvider
        • PlaylistProvider
      • Utils
      • Cordova
      • Rozwiązywanie problemów
Powered by GitBook
On this page
  1. DLA PROGRAMISTÓW
  2. Playlist Maker
  3. Providers

NotificationProvider

Zarządza danymi wyświetlanego modala.

NotificationProvider.js
import React, { useState } from 'react';
import useModal from 'components/organisms/Modal/useModal';

export const NotificationContext = React.createContext({
  isOpen: [],
  notificationData: {},
  openNotification: () => {},
  handleCloseModal: () => {},
});

const NotificationProvider = ({ children }) => {
  const { isOpen, handleOpenModal, handleCloseModal } = useModal();
  const [notificationData, setNotificationData] = useState({});

  const openNotification = (text, twoButtons = false, func) => {
    setNotificationData({
      text,
      twoButtons,
      func,
    });
    handleOpenModal();
  };

  return (
    <NotificationContext.Provider
      value={{
        isOpen,
        notificationData,
        openNotification,
        handleCloseModal,
      }}
    >
      {children}
    </NotificationContext.Provider>
  );
};

export default NotificationProvider;
PreviousFirebaseProviderNextPlaylistProvider

Last updated 1 year ago

🎶