0.1.81 • Published 3 years ago

pj-fan-login-signup-test v0.1.81

Weekly downloads
-
License
-
Repository
-
Last release
3 years ago

Picklejar Package Login Signup

Description

Picklejar login package is a package that provides a Login Component, Verify ID Component and Profile Component.

Installation

yarn install picklejar-package-login-signup

Usage

  • Import the package
import {
  AppContext, // The app context
  getApiHost, // The api host
  getEnvironment, // The environment
  getHost, // The host
  NotificationBar, // The notification bar
  NotificationProvider, // The notification provider
  PICKLEJAR_DEFAULT_PROFILE_PAGE_URL,  // The default profile page url
  PicklejarLogin, // The login component
  PicklejarProfile, // The profile component
  PicklejarTheme, // The theme
  UserContext, // The user context
  UserProvider // The user provider
} from 'pj-fan-login-signup';

import './lib/styles/picklejarTheme.css';
  • Wrap your app with the AppContext, UserProvider, NotificationProvider and ThemeProvider components
const App = props => {
  const { sessionKey } = props;

  const environment = useMemo(() => getEnvironment(), []);

  const apiHost = getApiHost(environment);
  const host = getHost(environment);

  const appContextValue = useMemo(() => (
    { host, apiHost }
  ), [host, apiHost]);

  const navigate = useNavigate();

  return (
    <AppContext.Provider value={appContextValue}>
      <UserProvider sessionKey={sessionKey}>
        <NotificationProvider>
          <NotificationBar />
          <UserContext.Consumer>
            {context => {
              const { isLogged, status } = context;
              return (
                <ThemeProvider theme={PicklejarTheme}>
                  <div className="App">
                    <Routes>
                      ...
                      {status !== 'new-ngo' && (
                        <Route
                          exact
                          path="/"
                          element={
                            <PicklejarLogin
                              loginRedirect={PICKLEJAR_DEFAULT_PROFILE_PAGE_URL}
                              navigate={navigate}
                            />
                          }
                        />
                      )}
                      ...
                    </Routes>
                  </div>
                </ThemeProvider>
              );
            }}
          </UserContext.Consumer>
        </NotificationProvider>
      </UserProvider>
    </AppContext.Provider>
  );
};

App.defaultProps = {
  sessionKey: 'session_key_value'
};

App.propTypes = {
  sessionKey: PropTypes.string
};

export default App;
0.1.52

3 years ago

0.1.53

3 years ago

0.1.54

3 years ago

0.1.10

3 years ago

0.1.55

3 years ago

0.1.11

3 years ago

0.1.56

3 years ago

0.1.12

3 years ago

0.1.57

3 years ago

0.1.13

3 years ago

0.1.58

3 years ago

0.1.14

3 years ago

0.1.59

3 years ago

0.1.15

3 years ago

0.1.51

3 years ago

0.1.41

3 years ago

0.1.42

3 years ago

0.1.43

3 years ago

0.1.44

3 years ago

0.1.45

3 years ago

0.1.46

3 years ago

0.1.47

3 years ago

0.1.48

3 years ago

0.1.80

3 years ago

0.1.81

3 years ago

0.1.40

3 years ago

0.1.8

3 years ago

0.1.39

3 years ago

0.1.7

3 years ago

0.1.9

3 years ago

0.1.6

3 years ago

0.1.74

3 years ago

0.1.30

3 years ago

0.1.75

3 years ago

0.1.31

3 years ago

0.1.76

3 years ago

0.1.32

3 years ago

0.1.77

3 years ago

0.1.78

3 years ago

0.1.34

3 years ago

0.1.79

3 years ago

0.1.35

3 years ago

0.1.36

3 years ago

0.1.37

3 years ago

0.1.70

3 years ago

0.1.71

3 years ago

0.1.72

3 years ago

0.1.27

3 years ago

0.1.28

3 years ago

0.1.29

3 years ago

0.1.63

3 years ago

0.1.64

3 years ago

0.1.20

3 years ago

0.1.65

3 years ago

0.1.21

3 years ago

0.1.66

3 years ago

0.1.22

3 years ago

0.1.67

3 years ago

0.1.23

3 years ago

0.1.68

3 years ago

0.1.24

3 years ago

0.1.69

3 years ago

0.1.25

3 years ago

0.1.60

3 years ago

0.1.61

3 years ago

0.1.62

3 years ago

0.1.16

3 years ago

0.1.17

3 years ago

0.1.18

3 years ago

0.1.19

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago