Coder Social home page Coder Social logo

react-browser-ui's Introduction

react-browser-ui

use browser ui components inside your app!

NPM JavaScript Style Guide

Chrome (showHeader = true) Chrome (showHeader = false)
Browser ui example 1 Browser ui example 2
Firefox (showHeader = true) Firefox (showHeader = false)
Browser firefox ui example 1 Browser firefox ui example 2
Safari
Browser safari ui example 1

Install

npm install --save react-browser-ui

Usage

Chrome Example

import React from 'react'
import Browser, { Chrome } from 'react-browser-ui'

const { Tab, Divider, AddButton } = Chrome

export default function ChromeExample ({ showHeader = false }) {
  const tabEnd = (
    <React.Fragment>
      <Divider />
      <AddButton />
    </React.Fragment>
  )
  return (
    <div style={{ width: 600, height: 500 }}>
      <Browser
        type={'chrome'}
        showHeader={showHeader}
        activeTabKey={'green'}
        tabEnd={tabEnd}>
        <Tab key={'green'} imageUrl={''} imageAlt={'green tab image'} title={'Green'}>
          <div style={{ backgroundColor: 'green', height: '100%', width: '100%', opacity: 0.9, display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
            <h1 style={{ color: 'white', margin: 0 }}>{'Your component here'}</h1>
          </div>
        </Tab>
        <Tab key={'blue'} imageAlt={'blue tab image'} title={'Blue'}>
          <div style={{ backgroundColor: 'green', height: '100%', width: '100%', opacity: 0.9, display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
            <h1 style={{ color: 'white', margin: 0 }}>{'Your component here'}</h1>
          </div>
        </Tab>
      </Browser>
    </div>
  )
}

Firefox Example

import React from 'react'
import Browser, { Firefox } from 'react-browser-ui'

const { Tab, Divider, AddButton } = Firefox

export default function FirefoxExample () {
  const tabEnd = (
    <React.Fragment>
      <Divider />
      <AddButton />
    </React.Fragment>
  )
  return (
    <div style={{ width: 600, height: 500 }}>
      <Browser
        type={'firefox'}
        showHeader={false}
        activeTabKey={'green'}
        tabEnd={tabEnd}>
        <Tab key={'green'} imageAlt={'green tab image'} title={'Green'}>
          <div style={{ backgroundColor: 'green', height: '100%', width: '100%', opacity: 0.9, display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
            <h1 style={{ color: 'white', margin: 0 }}>{'Your component here'}</h1>
          </div>
        </Tab>
        <Tab key={'blue'} imageUrl={''} imageAlt={'blue tab image'} title={'Blue'}>
          <div style={{ backgroundColor: 'green', height: '100%', width: '100%', opacity: 0.9, display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
            <h1 style={{ color: 'white', margin: 0 }}>{'Your component here'}</h1>
          </div>
        </Tab>
      </Browser>
    </div>
  )
}

Safari Example

import React from 'react'
import Browser, { Safari } from 'react-browser-ui'

const { Tab, Divider, AddButton } = Safari

export default function SafariExample () {
  const tabEnd = (
    <React.Fragment>
      <Divider />
      <AddButton />
    </React.Fragment>
  )
  return (
    <div style={{ width: 600, height: 500 }}>
      <Browser
        type={'safari'}
        showHeader={false}
        activeTabKey={'green'}
        tabEnd={tabEnd}>
        <Tab key={'green'} imageUrl={''} imageAlt={'green tab image'} title={'Green'}>
          <div style={{ backgroundColor: 'green', height: '100%', width: '100%', opacity: 0.9, display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
            <h1 style={{ color: 'white', margin: 0 }}>{'Your component here'}</h1>
          </div>
        </Tab>
        <Tab key={'blue'} imageUrl={''} imageAlt={'blue tab image'} title={'Blue'}>
          <div style={{ backgroundColor: 'green', height: '100%', width: '100%', opacity: 0.9, display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
            <h1 style={{ color: 'white', margin: 0 }}>{'Your component here'}</h1>
          </div>
        </Tab>
      </Browser>
    </div>
  )
}

API

Browser

Prop Type Default Description
type String 'chrome' browser type (currently chrome, firefox and safari is supported)
showHeader Boolean false whether to show header of the browser
activeTabKey String, Number undefined active tab's key
tabEnd ReactElements <React.Fragment /> additional react elements that will be insterted end of the tabs
children ReactElements <React.Fragment /> Tab element collection will passed as a child in here
onChange Function undefined if you want your browser to be controlled by your state use 'onChange' property that sends 'key' of the 'Tab' as first parameter
onClose Function undefined action will be fired when browser close button clicked
onMinifyClick Function undefined action will be fired when browser minify button clicked
onFullscreenClick Function undefined action will be fired when browser fullscreen button clicked

Tab

Prop Type Default Description
key String, Number undefined tab key is required and will be used when determining active tab
imageUrl String undefined thumbnail image of the tab
imageAlt String '' alt attribute of image
title String, ReactElements '' title of the tab
children ReactElements <React.Fragment /> tab content, your component will go here
onClose Function undefined action will be fired when tab close button clicked

Divider

Vertically divides items.

Prop Type Default Description
- - - -

AddButton

Circle add button. It can take any native button properties as a prop

Prop Type Default Description
- - - -

License

MIT © ismailnamdar

react-browser-ui's People

Contributors

ismailnamdar avatar

Stargazers

biyam avatar Lucas Medina avatar Mohammad Raziei avatar mukul avatar Roman avatar  avatar John Daniels avatar Rahul Banerjee avatar Willian Santana avatar  avatar zhengxs2018 avatar Talha Baris avatar Nafiz Bayındır avatar Safa Keskin avatar Burak Bilge Yalçınkaya avatar Batu avatar Şahin Olut avatar Hande Hamamcı avatar Erkan Zileli avatar

Watchers

James Cloos avatar  avatar Hande Hamamcı avatar

react-browser-ui's Issues

Typescript declaration missing

Could not find a declaration file for module 'react-browser-ui'. '/node_modules/react-browser-ui/dist/index.js' implicitly has an 'any' type.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.