1.0.11 • Published 4 months ago

react-electronix v1.0.11

Weekly downloads
-
License
ISC
Repository
github
Last release
4 months ago

React ElectroniX

react-electronix is a library that provides components to simulate the appearance of devices like iPhones and Macbooks in a React application.

Installation

You can install react-electronix using npm:

npm install react-electronix

Usage

Mac component

The Mac component simulates the appearance of a Macbook. It accepts the following props:

PropTypeDefaultDescription
openbooleantrueWhether the Macbook is open or closed
widthnumber600The width of the Macbook in pixels
startupbooleanfalseWhether to show a startup animation
animateOpenbooleanfalseWhether to animate the opening/closing of the Macbook
openAnglenumber (degrees)0The angle at which the Macbook opens (0 for fully flat, 90 for fully open)
childrenReact.ReactNodeThe content to display on the Macbook screen

Here's an example usage of the Mac component:

import { Mac } from 'react-electronix';

function App() {
  return (
    <Mac open={true} width={800} animateOpen={true} startup={true}>
      <h1>Hello, World!</h1>
    </Mac>
  );
}

Iphone component

The Iphone component simulates the appearance of an iPhone. It accepts the following props:

PropTypeDefaultDescription
widthnumber400The width of the iPhone in pixels
childrenReact.ReactNodeThe content to display on the iPhone screen (e.g. a mobile website)

Here's an example usage of the Iphone component:

import { Iphone } from 'react-electronix';

function App() {
  return (
    <Iphone width={400}>
      <h1>Hello, World!</h1>
    </Iphone>
  );
}

License

This library is licensed under the MIT License.