Giter Club home page Giter Club logo

react-browser-frame's Introduction

react-browser-frame

Zhoozh up your content with this responsive browser frame mockup.

Typescript-friendly.

Install

npm install react-browser-frame

or

yarn add react-browser-frame

Usage

Stick whatever you like inside a <BrowserFrame> and it will render as children props. The BrowserFrame component will be 100% as wide as its parent, and as high as the content you pass in to it.

Examples

An image

Image example

import React from "react";
import BrowserFrame from "react-browser-frame";

import myImg from "./img/doge.jpg";

export default () => (
  <BrowserFrame url="http://zombo.com">
    <img src={myImg} alt="A handsome doggo" />
  </BrowserFrame>
);

Text content

Text content example

export default () => (
  <BrowserFrame url="https://example.biz" padding="30px 20px">
    <p>It was the best of times, it was the blurst of times...</p>
  </BrowserFrame>
);

An iframe

Iframe example

const iframeSrc =
  "https://codepen.io/liamj/embed/preview/VdqgZK?height=500&amp;theme-id=39032&amp;default-tab=result";

export default () => (
  <BrowserFrame>
    <iframe
      width="100%"
      height="500px"
      scrolling="no"
      title="Breezy Windows logo"
      src={iframeSrc}
      frameBorder="no"
    />
  </BrowserFrame>
);

Props

<BrowserFrame> accepts the following props:

  • url (optional, string): Shows the address bar with your specified string.
  • padding (optional, string): Puts padding around your supplied content, as a CSS string, e.g. "20px" or "15px 30px" etc.
  • ???: What else would you like to see? Dark mode? Other styles n' props? Raise a PR or flick me a note :)

Styles partially copied from the browser mockup in Docusaurus v2 ๐Ÿ˜…

License

MIT ยฉ liamjohnston

react-browser-frame's People

Contributors

liamjohnston avatar winnsterx 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.