0.3.18 • Published 3 days ago

@ukpc-lib/react v0.3.18

Weekly downloads
-
License
ISC
Repository
-
Last release
3 days ago

@ukpc-lib/react

@ukpc-lib is a comprehensive npm library designed to provide a suite of reusable components, themes, colors, hooks, and auth providers for UKPC applications. It aims to streamline development and ensure consistency across different projects.

Installation

React

To install package, use the following command:

npm install @ukpc-lib/react

.NET

With .NET applications, you can import the script and use it as follows:

Topbar: https://unpkg.com/@ukpc-lib/react@latest/web-components-bundle/global-topbar/index.js

Global Menu: https://unpkg.com/@ukpc-lib/react@latest/web-components-bundle/global-menu/index.js

Usage

To ensure the correct display, you should use the layout as shown below:

React

After installation, you can start using components by importing it into your project. Here's an example of how to use Global Menu:

import { GlobalMenu } from '@ukpc-lib/react/components';
import { useAuth } from '@ukpc-lib/react/share';
import { Outlet } from 'react-router-dom';
import TopBar from './TopBar';
import { useTranslation } from '@ukpc-lib/react/share';

export default function PrivateLayout() {
  const { logout } = useAuth();
  const { ready } = useTranslation();
  
  return (
    ready && ( <div style={{ display: 'flex', flexDirection: 'column', height: '100vh' }}>
      <div style={{ height: '64px' }}>
        <TopBar />
      </div>
      <div
        style={{
          display: 'flex',
          flexDirection: 'row',
          flex: 1,
          overflow: 'hidden',
        }}
      >
        <GlobalMenu
          baseUrl="https://saas.dev-intelli-park.com"
          menuPath="/global-menu-config/api/v1/menu-items/user"
          logout={logout}
        />
        <div style={{ flex: 1, padding: '40px', overflow: 'auto' }}>
          <Outlet />
        </div>
      </div>
    </div> )
  );
}

.NET

<div style="display: flex; flex-direction: column; height: 100vh;">
  <div style="height: 64px;">
    <global-topbar
      base-url="@baseurl"
      user="@userJson"
      logo="logoURL"
    ></global-topbar>
  </div>
  <div style="display: flex; flex-direction: row; flex: 1; overflow: hidden;">
    <global-menu
      menu-path="/global-menu-config/api/v1/menu-items/user"
      base-url="@baseurl"
      logout="logout"
    ></global-menu>
    <div style="flex: 1; padding: 40px; overflow: auto;">
      <Outlet />
    </div>
  </div>
</div>

API

Global menu:

  • baseUrl: This is the root path where the global menu resources are located.
  • menuPath: This is appended to the baseUrl to form the full URL to the menu resource.
  • logout(): A method that logs out the current user. When called, it will clear the user's session and redirect them to the login page.

Topbar:

  • baseUrl: This is the root path where the global topbar resources are located.
  • user: A JSON string representing the current user.
  • logo: The URL of the logo image to be displayed on the topbar.

Details documentation of Components and Shared Authentication Logic Links

Contributing

We always welcome community contributions. If you want to contribute, please create a Pull Request and we will review it.

0.3.18

3 days ago

0.3.17

4 days ago

0.3.16

5 days ago

0.3.15

5 days ago

0.3.14

5 days ago

0.3.13

5 days ago

0.3.12

5 days ago

0.3.8

7 days ago

0.3.7

7 days ago

0.3.9

6 days ago

0.3.11

6 days ago

0.3.10

6 days ago

0.3.6

9 days ago

0.3.5

9 days ago

0.3.4

9 days ago

0.3.3

9 days ago

0.3.2

11 days ago

0.3.1

11 days ago

0.2.50

18 days ago

0.3.0

18 days ago

0.2.49

18 days ago

0.2.48

18 days ago

0.2.45

19 days ago

0.2.44

21 days ago

0.2.43

25 days ago

0.2.42

25 days ago

0.2.41

27 days ago

0.2.40

1 month ago

0.2.39

1 month ago

0.2.38

1 month ago

0.2.37

1 month ago

0.2.36

1 month ago

0.2.35

1 month ago

0.2.34

1 month ago

0.2.33

1 month ago

0.2.30

1 month ago

0.2.29

1 month ago

0.2.27

1 month ago

0.2.28

1 month ago

0.2.26

1 month ago

0.2.23

1 month ago

0.2.22

1 month ago

0.2.21

2 months ago

0.2.20

2 months ago

0.2.19

2 months ago

0.2.18

2 months ago

0.2.17

2 months ago

0.2.16

2 months ago

0.2.14

2 months ago

0.2.13

2 months ago

0.2.12

2 months ago

0.2.11

2 months ago

0.2.9

2 months ago

0.2.7

2 months ago

0.2.8

2 months ago

0.2.6

2 months ago

0.2.5

2 months ago

0.2.4

2 months ago

0.2.3

2 months ago

0.2.2

2 months ago

0.1.27

2 months ago

0.1.28

2 months ago

0.1.29

2 months ago

0.1.25

2 months ago

0.1.26

2 months ago

0.1.24

2 months ago

0.1.23

2 months ago

0.1.22

2 months ago

0.1.20

2 months ago

0.1.21

2 months ago

0.1.18

2 months ago

0.1.19

2 months ago

0.1.17

3 months ago

0.1.10

3 months ago

0.1.11

3 months ago

0.1.12

3 months ago

0.1.13

3 months ago

0.1.14

3 months ago

0.1.15

3 months ago

0.1.16

3 months ago

0.1.9

3 months ago

0.1.8

3 months ago

0.1.7

3 months ago

0.1.6

3 months ago

0.1.2

3 months ago

0.1.4

3 months ago

0.1.3

3 months ago

0.1.5

3 months ago

0.1.1

3 months ago

0.1.0

3 months ago

0.0.9

3 months ago

0.0.8

3 months ago

0.0.7

3 months ago

0.0.1

3 months ago

0.0.3

3 months ago

0.0.2

3 months ago

0.0.5

3 months ago

0.0.4

3 months ago

0.0.6

3 months ago

0.0.0

4 months ago