1.0.9 • Published 5 years ago

next-mobile-view v1.0.9

Weekly downloads
1
License
Apache-2.0
Repository
github
Last release
5 years ago

NOT WORKING FOR NOW

NextJS Mobile View

Easily switch your Next apps to mobile view

Usage

const Home = () => (
    <div>
        Default view
    </div>
);
Home.MobileView = () => (
    <div>
        Mobile view
    </div>
);
export default Home

Activate On App

You can activate next-page-middleware in your application by adding a few line to the _app.js module.
What is _app.js

import React from 'react'
import withMobileView from 'next-mobile-view'
import App from 'next/app'
class MyApp extends App {
  render() {
    const { Component, pageProps } = this.props;
    return <Component {...pageProps} />
  }
}

export default withMobileView(MyApp)

Install

With Npm
npm i next-mobile-view
With Yarn
yarn add next-mobile-view

Props

The props are the same in both functions.

import cx from 'classnames'
const Home = (props) => (
    <div className={cx(props.className, 'home-desktop')}>
        Default view
    </div>
);
Home.MobileView = (props) => (
    <div className={cx(props.className, 'home-mobile')}>
        Mobile view
    </div>
);
Home.getInitialProps = () => {
    return {
        className: 'home' 
    }
};
export default Home

Built With

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

  • Musa Kurt - Initial work - whthT

See also the list of contributors who participated in this project.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago