0.0.8 • Published 5 years ago

intranets-phonebook v0.0.8

Weekly downloads
21
License
Not open source
Repository
-
Last release
5 years ago

Intranets Phonebook

Internal API

Install

NPM

npm install intranets-phonebook --save

Yarn

yarn add intranets-phonebook 

Sample React

import * as React from "react";
import { search } from "intranets-phonebook";
import { jsxIdentifier } from "@babel/types";
export interface Props {
  children?: React.ReactNode;
}

const APISECRET =  "**********" // replace with the Shared Secret you have received 
export interface State {
  searchResult: any;
}

export default class PhoneBook extends React.Component<Props, State> {

  constructor(props: Props) {
    super(props);

    this.state = {
      searchResult: null
    };
  }

  render() {
    return (
      <div>
        <input
          type="text"
          style={{
            fontSize: "48px",
            width: "100%",
            margin: "40px",
            padding: "10px"
          }}
          placeholder="Enter a part of the name, email or phonenumber"
          onInput={(e: any) => {
            var searchFor: any = e.currentTarget.value;

            search( APISECRET, searchFor, (result: any) => {
              this.setState({ searchResult: result });
            });
          }}
        ></input>
        <div>
          {this.state.searchResult && (
            <div>
              {this.state.searchResult.results.map((address: any) => {
                return (
                  <div
                    key={address.mail}
                    style={{
                      textAlign: "left",
                      fontSize: "48px",
                      width: "100%",
                      margin: "40px",
                      padding: "10px"
                    }}
                  >
                    <div>{address.name}</div>
                    <div>
                      E-mail:{" "}
                      <a href={"mailto:" + address.mail}>{address.mail}</a>
                    </div>
                    <div>Mobile: {address.mobile}</div>
                    <div>Phone: {address.phone}</div>
                    {JSON.stringify(address)}
                  </div>
                );
              })}
            </div>
          )}
        </div>
      </div>
    );
  }
}
0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago