0.0.28 • Published 1 month ago

@sito/dashboard v0.0.28

Weekly downloads
-
License
ISC
Repository
github
Last release
1 month ago

@sito/dashboard

A React library for building customizable and responsive dashboards with ease.

Features

  • Table Component: A powerful table component with support for sorting, pagination, and customizable columns.
  • Translation Support: Built-in translation support using a TranslationProvider.
  • Customizable: Easily style and configure components to fit your needs.
  • Lightweight: Optimized for performance and usability.

Installation

To install the library, use npm or yarn:

# Using npm
npm install @sito/dashboard

# Using yarn
yarn add @sito/dashboard

Table

Here’s how you can use the Table component in your project:

import React from "react";
import { Table } from "sito-dashboard";

const App = () => {
  const rows = [
    { id: 1, name: "John Doe", age: 30 },
    { id: 2, name: "Jane Smith", age: 25 },
  ];

  const parseRows = (row) => ({
    id: row.id,
    name: row.name,
    age: row.age,
  });

  const columns = [
    { key: "name", label: "Name" },
    { key: "age", label: "Age" },
  ];

  return (
    <Table
      title="User Table"
      rows={rows}
      parseRows={parseRows}
      columns={columns}
    />
  );
};

export default App;

Translation for its components

Wrap your application with the TranslationProvider to enable translations:

import React from "react";
import { TranslationProvider } from "@sito/dashboard";

const translations = {
  en: { hello: "Hello" },
  es: { hello: "Hola" },
};

const App = () => {
  const t = (key) => translations["en"][key]; // Example translation function

  return (
    <TranslationProvider t={t}>
      <h1>{t("hello")}</h1>
    </TranslationProvider>
  );
};

export default App;

Components

Table

The Table component is a flexible and feature-rich table for displaying data.

Props

  • title (string): The title of the table.
  • rows (array): The data to display in the table.
  • parseRows (function): A function to parse rows for rendering.
  • columns (array): Column definitions, including keys and labels.
  • isLoading (boolean): Whether the table is in a loading state.
  • actions (function): A function to render actions for each row.
  • className (string): Custom class for the table container.

TranslationProvider

Provides translation support for your application.

Props

  • t (function): A translation function that takes a key and returns the translated string.

Development

Running Locally

To run the project locally:

  1. Clone the repository:
git clone https://github.com/your-repo/sito-dashboard.git

cd sito-dashboard
  1. Install dependencies:
npm install
  1. Start the development server
npm start

Building the Library

To build the library for production

npm run build

Contributing

Contributions are welcome! Please follow these steps: 1. Fork the repository. 2. Create a new branch for your feature or bugfix. 3. Submit a pull request with a detailed description of your changes.

License

This project is licensed under the MIT License.

0.0.20

3 months ago

0.0.21

3 months ago

0.0.22

3 months ago

0.0.23

3 months ago

0.0.24

3 months ago

0.0.25

1 month ago

0.0.15

8 months ago

0.0.16

8 months ago

0.0.17

8 months ago

0.0.18

3 months ago

0.0.19

3 months ago

0.0.10

8 months ago

0.0.11

8 months ago

0.0.12

8 months ago

0.0.14

8 months ago

0.0.27

1 month ago

0.0.28

1 month ago

0.0.9

9 months ago

0.0.8

10 months ago

0.0.7

10 months ago

0.0.6

11 months ago

0.0.5

11 months ago

0.0.4

11 months ago

0.0.3

11 months ago

0.0.2

11 months ago

0.0.1

11 months ago