All Projects → kimolalekan → react-device-frame

kimolalekan / react-device-frame

Licence: MIT license
Preview website on a device

Programming Languages

javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to react-device-frame

Device Detector Js
A precise user agent parser and device detector written in TypeScript
Stars: ✭ 193 (+704.17%)
Mutual labels:  device, phone
react-device-frameset
React device frameset component
Stars: ✭ 30 (+25%)
Mutual labels:  device, phone
Mobile Device Detect
Detect mobile device and its type.
Stars: ✭ 132 (+450%)
Mutual labels:  device
numvalidate
Phone number validation REST API
Stars: ✭ 54 (+125%)
Mutual labels:  phone
Camera2
Camera App write with api 2
Stars: ✭ 222 (+825%)
Mutual labels:  phone
Hidguardian
Windows kernel-mode driver for controlling access to various input devices.
Stars: ✭ 138 (+475%)
Mutual labels:  device
phonenumber
With a given country and phone number, validate and format the MOBILE phone number to E.164 standard
Stars: ✭ 108 (+350%)
Mutual labels:  phone
Fcuuid
iOS UUID / Universally Unique Identifiers library as alternative to UDID and identifierForVendor. 📱
Stars: ✭ 1,387 (+5679.17%)
Mutual labels:  device
Hardware.Info
Battery, BIOS, CPU - processor, storage drive, keyboard, RAM - memory, monitor, motherboard, mouse, NIC - network adapter, printer, sound card - audio card, graphics card - video card. Hardware.Info is a .NET Standard 2.0 library and uses WMI on Windows, /dev, /proc, /sys on Linux and sysctl, system_profiler on macOS.
Stars: ✭ 238 (+891.67%)
Mutual labels:  device
discord-group-spammer
You need to run all_together.py and follow the instructions on the readme below. This Tool allows you to use various discord exploits for educational use.
Stars: ✭ 45 (+87.5%)
Mutual labels:  phone
Iosdevicesupport
存放iOS镜像文件、iOSDeviceSupport、真机调试包、DeviceSupport、iOS-DeviceSupport,供大家参考,目前收录iOS8.0~iOS14.5,持续更新中
Stars: ✭ 197 (+720.83%)
Mutual labels:  device
Apple Device Model List
All Apple devices model name list. 通过内部编号判断 iOS 设备型号。
Stars: ✭ 149 (+520.83%)
Mutual labels:  device
FritzBoxTelefon-dingsbums
Das Fritz!Box Telefon-dingsbums ist ein Outlook-Addin, welches ein direktes Wählen der Kontakte aus Outlook ermöglicht. Zusätzlich bietet es nützliche Funktionen, wie einen Anrufmonitor oder eine Rückwärtssuche.
Stars: ✭ 16 (-33.33%)
Mutual labels:  phone
Easydeviceinfo
📱 [Android Library] Get device information in a super easy way.
Stars: ✭ 1,698 (+6975%)
Mutual labels:  device
TouchbarBBT
美化 Macbook Pro Touch Bar
Stars: ✭ 27 (+12.5%)
Mutual labels:  macbook
S2e
S2E: A platform for multi-path program analysis with selective symbolic execution.
Stars: ✭ 102 (+325%)
Mutual labels:  device
Devicelayout
📱AutoLayout can be set differently for each device
Stars: ✭ 170 (+608.33%)
Mutual labels:  device
STM32 TimerInterrupt
This library enables you to use Interrupt from Hardware Timers on an STM32F/L/H/G/WB/MP1-based board. These STM32F/L/H/G/WB/MP1 Hardware Timers, using Interrupt, still work even if other functions are blocking. Moreover, they are much more precise (certainly depending on clock frequency accuracy) than other software timers using millis() or micr…
Stars: ✭ 27 (+12.5%)
Mutual labels:  device
purelove
Purelove is a lightweight penetration testing framework, in order to better security testers testing holes with use.
Stars: ✭ 52 (+116.67%)
Mutual labels:  frame
AXIOM-Remote
A device to control AXIOM cameras.
Stars: ✭ 24 (+0%)
Mutual labels:  device

React Device Frame

This is a rewrite of Olalekan Animashaun's React wrapper for Devices.css. It adds a snazzy <Dock> component to put your <Device> frame in and allows you to load whatever you want to into the <Device> through props.show or as <Device>{children}</Device>

Preview: none yet...dev folder soon, storybook later.

Supported devices

  • iPhone X (Silver)

  • iPhone 8 (Silver, Gold and Black)

  • iPhone 8 Plus (Silver, Gold and Black)

  • iPhone 5S (Silver, Gold and Black)

  • iPhone 5C (White, Red, Yellow, Green and Blue)

  • iPhone 4S (Silver, Gold and Black)

  • iPad (White and Black)

  • MacBook Pro

  • Samsung Galaxy S5

  • Samsung Galaxy Note 8

  • HTC one

  • Nexus 5

  • Lumia 920 (White, Red, Yellow, Black and Blue)

Installation... npm? not yet.

... no npm package for this version, so you can’t do this:

npm i react-device-frame --save

Installation... for now.

clone the project into a subfolder of your CRA project. I like src/lib/.

cd your/CRA-project-folder/src
mkdir lib && cd lib
git clone https://github.com/perfectcube/react-device-frame.git

Drop this into your src/jsconfig.json file:

{
  ...
  "compilerOptions": {
    "baseUrl": "src",
    "paths": {
      "": ["src/"]
    }
  }
  ...
}

... and you're off to the races!

Usage

import React, { Component } from "react";
import Device from "lib/react-device-frame";

class ShowWebpage extends Component {
  render() {
    // NOTE: You'll have a rough time displaying a website in Chrome that's sending back a 'X-Frame-Options=sameorigin' header. You'll get an error in the console like: 
    // Refused to display 'https://www.google.com/' in a frame because it set 'X-Frame-Options' to 'sameorigin'.
    // Try one of these instead: http://mentalfloss.com/article/53792/17-ancient-abandoned-websites-still-work ... Maybe learn Klingon? https://www.kli.org/
    return <Device use="iphone-8" color="gold" show="https://www.kli.org/" />;
  }
}

class ShowComponents extends Component {
  render() {
    const content = (
      <div>
      	<p>this is content</p>
      	<p>wahtever you want to have in here is fine</p>
      	<Button>I'm a custom component</Button>
      </div>
    );
    return <Device use="iphone-5c" show={content} color="red" />;
  }
}

class ShowComponentsAsChildren extends Component {
  render() {
    return (
      <Device use="macbook-pro">
      	<div>
      		<p>this is content</p>
      		<p>wahtever you want to have in here is fine</p>
      		<Button>I'm a custom component</Button>
      	</div>
    	</Device>
    );
  }
}

class SpiffyMobileDevicesDock extends Component {
  
  updatePreview(data){
    console.log({
      'got update from <Dock>':data
    });
  }
  
  render() {
    
    const content = (
      <div>
      	<p>this is content</p>
      	<p>wahtever you want to have in here is fine</p>
      	<Button>I'm a custom component</Button>
      </div>
    );
    
    return (
    	<Dock
        device="iphone-x" 
        tooltip="Show a mobile Preview" 
        open="Mobile Preview" 
        close="Hide Preview"
        zoom={{
          full: "Huge",
          large: "Large",
          med: "Medium",
          small: "Small",
        }}
        view="large"
        onData={(update)=>{
          this.updatePreview(update);
        }}
        hide={['ipad','macbook-pro']}
        padTop={55}
        orientation="protrait"
       >
				<Device 
        	use="iphone-x"
          color="black" 
          orientation="protrait"
         >{content}</Device>
       </Dock>
    );
  }
  
}

<Device> Properties

Property Value Type
use iphone-x, iphone-8, iphone-8plus, iphone-5s, iphone-5c, iphone-4s, ipad-mini, nexus-5, htc-one, galaxy-s5, galaxy-note8, macbook-pro; default is iphone-x string
color Depends on the device. Use Device.getColors('device-name') to get all supported colors and use Device.getColor('device-name') to get the device default color. string
show A url or any <Component>. Show is optional but <Device> won’t show anything unless you declare show={something} or give <Device><p>a child</p></Device>. Note that we don’t check if you're passing in a valid url... enjoy! string
component
undefined
orientation one of protrait or landscape. string
title Only used as the title attribute in the <iframe> if props.show is a url string

<Dock> Properties

Property Value Type
device (required) The initially selected device in the device switcher pulldown string
view (required) The zoom level that you want to show the device at. One of 'full', 'large', 'med', or 'small'. string
close (optional) The text on the dock close button string
open (optional) The text on the dock open button string
zoom (optional) The text on the zoom selector options. The default values are:
{
full: "Huge",
large: "Large",
med: "Medium",
small: "Small",
}
object
onData (optional) A callback that recieves all selected options as a single argument whenever you change an option. The object you're passed has the following keys
• zoom {string} one of: 'full','large','med','small'. this is the currently selected zoom level.
• device {string} one of Device.SUPPORTED_DEVICES, like: "the-device-slug"
• orient {string} "landscape" or "portrait"
• color {string} the currently selected human readable color name. Map this to the #hex color for the with Device.colorMap('device-type','color')
• float {string} "right" or "left"
function
hide (optional) An array of devices to remove from the device selector pulldown. For example, if you wanted to only show phones in the 's device selection pulldown you'd do this: hide={['macbook-pro','ipad']}. See: › Properties › use for valid values. array
show (optional) Let’s you turn off visual elements within the <Dock/>. You have these options, bold is default:
• zoom: [true | false] The device zoom pulldown
•switcher: [true | false] The device frame switcher pulldown
•color: [true | false] The color selector
•float: [true | false] The drawer position button
orientation: [true | false] -- not implimeted yet.
Example:
show={{color:false}}
This would hide the color selection menu for all devices.
object
padTop (optional) A number of pixels that you want to pad the top of the dock down from the top of the window frame. Handy if you're displaying the dock with a header reagion that you don’t want to overlap with the device. int
tooltip (optional) Shows a <ReactTooltip> for the <Dock> open button if you pass in a string. string

LICENSE: MIT

Developer: Dan Bryant. Original Author: Olalekan Animashaun

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].