Giter VIP home page Giter VIP logo

browser-app's Introduction

browser-app

React-based template for a single page app with search/content/actions

Dependencies

  • React
  • Jquery (not in package.json)

Props

searchPath should be a url which returns JSON. The search term will be passed as the f query parameter. The JSON object should have these keys:

  • results: an array of matching items. Each item should have these keys:
    • id -- must be unique among all items
    • html -- the html which will render this item in the search results

Optionally, the item can have a url key. If so, when the search result is clicked, the viewport will load content from this url.

searchPlaceholder is optional, and can be a string to use as placeholder text in the search box

CSS

You should include browser-app.css on your page at a minimum. This styles the app in a 2-column format with search results on the left and content on the right.

If the viewport region (children of the BrowserApp element, or html loaded from search results) contains a div with the class browser-app-actions, children of this div with the class browser-app-action will be fixed to the top right of the page in a menu. See the example below for how this works.

Example

<BrowserApp searchPath="/search.json" searchPlaceholder="Search for stuff">
  <h2>This area is the "viewport"</h2>
  <p>Initial content goes here.</p>

  <div className="browser-app-actions">
    <div className="browser-app-action">
      <a href="#"><i className="fa fa-save" /></a>
    </div>

    <div className="browser-app-action">
      <a href="#"><i className="fa fa-remove" /></a>
    </div>

    <hr />

    <div className="browser-app-action">
      <a href="#"><i className="fa fa-home" /></a>
    </div>
  </div>
</BrowserApp>

This will create an app which looks something like this (sidebar results have also been added):

screen shot 2016-08-26 at 12 16 53 pm

Copyright

Copyright (c) 2016 Peter Woo, released under the MIT license

browser-app's People

Contributors

wioux avatar

Watchers

 avatar  avatar

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.