junhoyeo / react-mobile-sized-view

πŸ‘ Responsive Mobile-sized Wrapper for React - Easily prototype your mobile-sized web apps with desktop support

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

react-mobile-sized-view

React Mobile Sized View - πŸ‘ Responsive Mobile-sized Wrapper for React | Product Hunt

demo image

πŸ‘ Responsive Mobile-sized Wrapper for React

πŸš€ Examples

⚠️ Warning: The following examples can be using the outdated version of this package, and can not be the best usage here(this package was very ugly before I tidy up lol). Please use issues and PRs in this repository for sharing more ideas and suggestions, including proper exploits

πŸš€ Add your apps here too!

πŸ“¦ Usage

yarn add styled-components && yarn add -D @types/styled-components
yarn add react-mobile-sized-view
import React from 'react';
import MobileSizedView from 'react-mobile-sized-view';

const App: React.FC = () => (
  <MobileSizedView
    style={{ backgroundColor: '#F6DADB' }}
    screenStyle={{
      backgroundColor: '#fefefe',
      boxShadow: '-31px -31px 62px #FAE0E0, 31px 31px 62px #EAB6BE',
    }}
    isRounded
  >
    <h1>Title in Screen</h1>
  </MobileSizedView>
);

export default App;

βš“οΈ Hooks

import { useScreenSize } from 'react-mobile-sized-view';

const SomeComponent: React.FC = () => {
  const { width: screenWidth } = useScreenSize();
  // Comes with SSR support

  return (
    <div
      style={{
        width: screenWidth,
        height: screenWidth,
        backgroundColor: 'coral',
      }}
    />
  );
};

About

πŸ‘ Responsive Mobile-sized Wrapper for React - Easily prototype your mobile-sized web apps with desktop support


Languages

Language:TypeScript 96.6%Language:JavaScript 3.4%