0.1.81 • Published 1 year ago

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

Weekly downloads
-
License
-
Repository
-
Last release
1 year 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

1 year ago

0.1.53

1 year ago

0.1.54

1 year ago

0.1.10

1 year ago

0.1.55

1 year ago

0.1.11

1 year ago

0.1.56

1 year ago

0.1.12

1 year ago

0.1.57

1 year ago

0.1.13

1 year ago

0.1.58

1 year ago

0.1.14

1 year ago

0.1.59

1 year ago

0.1.15

1 year ago

0.1.51

1 year ago

0.1.41

1 year ago

0.1.42

1 year ago

0.1.43

1 year ago

0.1.44

1 year ago

0.1.45

1 year ago

0.1.46

1 year ago

0.1.47

1 year ago

0.1.48

1 year ago

0.1.80

1 year ago

0.1.81

1 year ago

0.1.40

1 year ago

0.1.8

1 year ago

0.1.39

1 year ago

0.1.7

1 year ago

0.1.9

1 year ago

0.1.6

1 year ago

0.1.74

1 year ago

0.1.30

1 year ago

0.1.75

1 year ago

0.1.31

1 year ago

0.1.76

1 year ago

0.1.32

1 year ago

0.1.77

1 year ago

0.1.78

1 year ago

0.1.34

1 year ago

0.1.79

1 year ago

0.1.35

1 year ago

0.1.36

1 year ago

0.1.37

1 year ago

0.1.70

1 year ago

0.1.71

1 year ago

0.1.72

1 year ago

0.1.27

1 year ago

0.1.28

1 year ago

0.1.29

1 year ago

0.1.63

1 year ago

0.1.64

1 year ago

0.1.20

1 year ago

0.1.65

1 year ago

0.1.21

1 year ago

0.1.66

1 year ago

0.1.22

1 year ago

0.1.67

1 year ago

0.1.23

1 year ago

0.1.68

1 year ago

0.1.24

1 year ago

0.1.69

1 year ago

0.1.25

1 year ago

0.1.60

1 year ago

0.1.61

1 year ago

0.1.62

1 year ago

0.1.16

1 year ago

0.1.17

1 year ago

0.1.18

1 year ago

0.1.19

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago