3.5.16 • Published 11 months ago

@nokkel/components v3.5.16

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

React Components

A repository for re-usable, React-based components for use across web applications within the Nokkel ecosystem.

Pre-requisites

Integration

To use this component library in your application, you need to set up i18next for internationalization support and react-router-dom for navigation components.

Installing i18next

npm install i18next react-i18next

Setting up i18next

Create an i18n.ts file in your project:

import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
import { getResources } from '@nokkel/react-components';

const resources = getResources();

i18n.use(initReactI18next).init({
  debug: false,
  lng: 'en',
  fallbackLng: 'en',
  interpolation: {
    escapeValue: false,
  },
  resources,
});

export default i18n;

Installing react-router-dom (Required for navigation components)

Some components use react-router-dom's Link component for navigation. Install it as a dependency:

npm install react-router-dom

Important: Components that use routing require your application to be wrapped in a Router provider (BrowserRouter, HashRouter, etc.).

Setting up react-router-dom

Wrap your application with a Router provider. Choose the appropriate router for your use case:

import React from 'react';
import { BrowserRouter } from 'react-router-dom';

function App() {
  return <BrowserRouter>{/* Your app content */}</BrowserRouter>;
}

export default App;

Contributing

To create a component directory, run `npm run create:component --name="INSERT NAME HERE"

To create an icon, run `npm run create:icon --name="INSERT NAME HERE"

Nokkel components are structured like so:

src/
├── components/
│   └── [Component]/
│       ├── [Component].css
│       ├── [Component].stories.tsx
│       ├── [Component].tsx
│       ├── index.ts
│       └── types.ts
├── content/
│   └── [namespace]/
│       ├── index.json
│       └── [provider].json
├── context/
│   ├── [context].tsx
│   └── index.ts
├── hooks/
│   ├── [hook].ts
│   └── index.ts
├── icons/
│   ├── [Icon]
|   ├── [Icon].stories.tsx
│   └── index.ts
├── styles/
│   └── global.css
├── sections/
│   └── [Section]/
│       ├── [Section].css
│       ├── [Section].stories.tsx
│       ├── [Section].tsx
│       ├── index.ts
│       └── types.ts
├── utils/
│   ├── [Util].ts
│   └── index.ts
└── index.ts
  • Component.css is where the component classes are stored. We use tailwind styles with the @apply for styles.
    • For brands, use the [data-theme="[brand]"] selector in order to change that specific class for brands.
    • See Button.css for a good example.
  • Component.stories.tsx is where the story for Storybook is stored.
    • Decorators may be used for containers in the case of responsive components.
    • Note: Storybook documentation oftentimes has a type issue with the satisfies Meta<typeof [Component]>. It's suggested to use the same pattern in Button.stories.tsx
    • The first story is used as the top example in Autodocs so it's best to ensure it has all the needed controls (though this can be manually added).
  • Component.tsx contains the actual component.
    • Using a Multi-line comment before the main export will be used by Autodocs in Storybook.
    • Add a data-testid=[component] for testing purposes and identification of component.
    • MaterialUI is used as a base for many components.
    • Button.tsx is a model component.
  • types.ts contains all the types such as props.
    • Comments before each props will be documented in storybook to help design know the fields that can be edited.
  • index.ts exports the component and types. We use this to export the component to the parent folder.
  • [namespace]/index.json is the translation file for the text content using i18next formatting.
  • [namespace]/[provider].json is the provider-specific variant translation file that overrides the default translations.
3.3.9

1 year ago

3.3.6

1 year ago

3.1.34

1 year ago

3.1.33

1 year ago

3.1.36

1 year ago

3.1.35

1 year ago

3.1.38

1 year ago

3.1.37

1 year ago

3.1.30

1 year ago

3.1.32

1 year ago

3.1.31

1 year ago

3.1.2

2 years ago

3.1.1

2 years ago

3.1.7

1 year ago

3.1.6

1 year ago

3.1.5

1 year ago

3.1.4

1 year ago

3.1.41

1 year ago

3.1.43

1 year ago

3.1.42

1 year ago

3.3.35

1 year ago

3.3.36

1 year ago

3.3.37

1 year ago

3.3.38

1 year ago

3.3.39

1 year ago

3.3.32

1 year ago

3.3.33

1 year ago

3.3.34

1 year ago

3.1.9

1 year ago

3.1.8

1 year ago

3.4.14

1 year ago

3.3.46

1 year ago

3.4.15

1 year ago

3.4.16

1 year ago

3.4.17

1 year ago

3.3.49

1 year ago

3.4.18

1 year ago

3.4.19

1 year ago

3.3.41

1 year ago

3.4.10

1 year ago

3.3.42

1 year ago

3.4.11

1 year ago

3.3.43

1 year ago

3.4.12

1 year ago

3.3.44

1 year ago

3.4.13

1 year ago

3.3.13

1 year ago

3.3.14

1 year ago

3.3.15

1 year ago

3.3.17

1 year ago

3.3.18

1 year ago

3.3.19

1 year ago

3.3.10

1 year ago

3.3.11

1 year ago

3.3.12

1 year ago

3.3.24

1 year ago

3.3.25

1 year ago

3.3.26

1 year ago

3.3.27

1 year ago

3.3.28

1 year ago

3.3.29

1 year ago

3.3.20

1 year ago

3.3.21

1 year ago

3.3.22

1 year ago

3.3.23

1 year ago

3.5.14

12 months ago

3.5.13

12 months ago

3.5.12

12 months ago

3.5.11

12 months ago

3.5.10

12 months ago

3.4.40

1 year ago

3.4.41

1 year ago

3.5.16

11 months ago

3.5.15

11 months ago

3.4.26

1 year ago

3.4.27

1 year ago

3.4.28

1 year ago

3.4.29

1 year ago

3.4.20

1 year ago

3.4.21

1 year ago

3.3.53

1 year ago

3.4.22

1 year ago

3.3.54

1 year ago

3.4.23

1 year ago

3.4.24

1 year ago

3.4.36

1 year ago

3.4.37

1 year ago

3.4.38

1 year ago

3.4.39

1 year ago

3.5.3

1 year ago

3.5.2

1 year ago

3.5.1

1 year ago

3.5.0

1 year ago

3.4.30

1 year ago

3.4.31

1 year ago

3.4.32

1 year ago

3.4.33

1 year ago

3.4.34

1 year ago

3.4.35

1 year ago

3.1.12

1 year ago

3.1.11

1 year ago

3.1.14

1 year ago

3.0.43

2 years ago

3.1.16

1 year ago

3.1.15

1 year ago

3.1.18

1 year ago

3.1.17

1 year ago

3.0.42

2 years ago

3.1.10

1 year ago

3.0.40

2 years ago

3.5.7

1 year ago

3.5.6

1 year ago

3.5.5

1 year ago

3.5.4

1 year ago

3.5.9

1 year ago

3.5.8

1 year ago

3.4.0

1 year ago

3.1.23

1 year ago

3.1.25

1 year ago

3.1.24

1 year ago

3.4.4

1 year ago

3.1.27

1 year ago

3.4.3

1 year ago

3.4.2

1 year ago

3.1.29

1 year ago

3.4.1

1 year ago

3.1.28

1 year ago

3.1.21

1 year ago

3.1.20

1 year ago

3.1.19

1 year ago

3.4.8

1 year ago

3.4.7

1 year ago

3.4.6

1 year ago

3.4.5

1 year ago

3.4.9

1 year ago

3.3.1

1 year ago

3.0.34

2 years ago

3.0.35

2 years ago

3.0.32

2 years ago

3.0.33

2 years ago

3.3.5

1 year ago

3.0.38

2 years ago

3.3.4

1 year ago

3.3.3

1 year ago

3.0.36

2 years ago

3.0.37

2 years ago

3.0.31

2 years ago

3.0.30

2 years ago

3.0.24

2 years ago

3.0.27

2 years ago

3.0.28

2 years ago

3.0.25

2 years ago

3.0.26

2 years ago

3.0.29

2 years ago

3.0.22

2 years ago

3.0.21

2 years ago

3.0.20

2 years ago

3.0.18

2 years ago

3.0.19

2 years ago

3.0.16

2 years ago

3.0.17

2 years ago

3.0.14

2 years ago

3.0.15

2 years ago

3.0.13

2 years ago

3.0.10

2 years ago

3.0.11

2 years ago

3.0.8

2 years ago

3.0.7

2 years ago

3.0.9

2 years ago

3.0.6

2 years ago

3.0.5

2 years ago

3.0.3

2 years ago

1.1.1

2 years ago

1.0.19

2 years ago

1.1.0

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.1.9

2 years ago

1.1.8

2 years ago

1.0.9

2 years ago

1.1.7

2 years ago

1.0.8

2 years ago

1.1.6

2 years ago

1.0.7

2 years ago

1.1.5

2 years ago

1.0.6

2 years ago

1.1.4

2 years ago

1.0.5

2 years ago

1.1.2

2 years ago

2.0.0-alpha.3

2 years ago

2.0.0-alpha.1

2 years ago

2.0.0-alpha.2

2 years ago

1.1.12

2 years ago

1.1.11

2 years ago

1.1.10

2 years ago

1.0.20

2 years ago

1.1.14

2 years ago

2.0.0

2 years ago

1.1.13

2 years ago

3.0.0

2 years ago

2.1.0-alpha.5

2 years ago

1.0.11

2 years ago

2.1.0-alpha.4

2 years ago

1.0.10

2 years ago

2.1.0-alpha.3

2 years ago

2.1.0-alpha.2

2 years ago

2.1.0-alpha.1

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.0

2 years ago