0.2.5-alpha-02 • Published 7 years ago

@kamva/ui-kit v0.2.5-alpha-02

Weekly downloads
8
License
ISC
Repository
github
Last release
7 years ago

Kamva UI Kit

Installation

$ npm install --save-dev @kamva/ui-kit

buttons

example:

import React from "react";
import { Button, PrimaryButton } from "@kamva/ui-kit";

const Example = () => {
  return (
      <Button>primary</Button>
      <PrimaryButton secondary>secondary button</Button>
      <PrimaryButton round>?</Button>
  ) ;
}

Input Props

propstypedefault
idstring. requirednull
labelstringnull. if its passed render label with input
errorbooleanfalse. if will be true border color changes
ltrbooleanfalse.

💡 Fomrik example:

import React from "react";
import { Input } from "@kamva/ui-kit";

const Example = () => (
  <div>
    <h1>My Form</h1>
    <Formik
      initialValues={{ email: "eee", color: "red", firstName: "" }}
      onSubmit={(values, actions) => {
        setTimeout(() => {
          alert(JSON.stringify(values, null, 2));
          actions.setSubmitting(false);
        }, 1000);
      }}
      render={(props: any) => {
        const { handleSubmit, email, values } = props;
        return (
          <form onSubmit={handleSubmit}>
            <Input
              type={"email"}
              value={values.email}
              name="email"
              placeholder="Email"
              id="email"
              label={"hello"}
            />
            <button type="submit">Submit</button>
          </form>
        );
      }}
    />
  </div>
);

CheckBox Props

propstypedefault
idstring. requirednull

Alert

its just wrapper for react-alert | props | type | default | | ----- | ---------------- | ------------------------------------------- | | optionsReactAlert | options | defaultOption |

default options

const providerOptions = { position: positions.TOP_CENTER, timeout: 3000, offset: "24px", transition: transitions.fade, };

usage

import React from "react";
import { AppAlert, useAlert } from "@kamva/ui-kit";

const App = () => {
  const alert = useAlert();

  return (
    <div>
      <button
        onClick={() => {
          alert.error(<p>عملیات با موفقیت انجام شد</p>);
        }}
      >
        Show Alert
      </button>
    </div>
  );
};

render(
  <AppAlert>
    <App />
  </AppAlert>,
  document.getElementById("root"),
);
0.2.6

7 years ago

0.2.5-alpha-08

7 years ago

0.2.5-alpha-07

7 years ago

0.2.5-alpha-06

7 years ago

0.2.5-alpha-05

7 years ago

0.2.5-alpha-04

7 years ago

0.2.5-alpha-03

7 years ago

0.2.5-alpha-02

7 years ago

0.2.5-alpha-01

7 years ago

0.2.5

7 years ago

0.2.4

7 years ago

0.2.3

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.9

7 years ago

0.1.8

7 years ago

0.1.7

7 years ago

0.1.6

8 years ago

0.1.5

8 years ago

0.0.1

8 years ago