Skip to content
This repository has been archived by the owner on Apr 12, 2022. It is now read-only.

Commit

Permalink
perfect...
Browse files Browse the repository at this point in the history
  • Loading branch information
nicodinh committed Feb 20, 2020
1 parent d4fd91a commit aeece46
Show file tree
Hide file tree
Showing 15 changed files with 261 additions and 5 deletions.
File renamed without changes.
17 changes: 17 additions & 0 deletions model/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import temperatureModel from './temperature-model'

const storeModel = {
temperature: temperatureModel
// devices: [
// {1: {temperature: temperatureModel}},
// {2: {temperature: temperatureModel}},
// {3: {temperature: temperatureModel}},
// {4: {temperature: temperatureModel}},
// {5: {temperature: temperatureModel}},
// {6: {temperature: temperatureModel}},
// {7: {temperature: temperatureModel}},
// {8: {temperature: temperatureModel}},
// ]
}

export default storeModel
9 changes: 9 additions & 0 deletions model/temperature-model.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { action } from 'easy-peasy'

const temperatureModel = {
value: 0,
values: [],
unity: 'C'
}

export default temperatureModel
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"micro": "^9.3.5-canary.3",
"micro-cors": "^0.1.1",
"next": "latest",
"next-redux-wrapper": "^4.0.1",
"prop-types": "^15.7.2",
"react": "latest",
"react-dom": "latest",
Expand Down
25 changes: 25 additions & 0 deletions pages/_app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import App from 'next/app'
import React from 'react'
import withRedux from 'next-redux-wrapper'
import { StoreProvider } from 'easy-peasy'
import { initializeStore } from '../store'

class MyApp extends App {
render () {
const { Component, pageProps, store } = this.props

console.log('__STORE__', store)

// Workaround for https://github.com/zeit/next.js/issues/8592
// const { err } = this.props
const modifiedPageProps = { ...pageProps }

return (
<StoreProvider store={store}>
<Component {...modifiedPageProps} />
</StoreProvider>
)
}
}

export default withRedux(initializeStore)(MyApp)
Empty file removed pages/api/newsletter.js
Empty file.
Empty file removed pages/details.js
Empty file.
71 changes: 66 additions & 5 deletions pages/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,71 @@
import '../styles/index.css'

export default () => (
<div className='p-4 shadow rounded bg-white'>
<h1 className='text-purple-500 leading-normal'>lifeinaweb</h1>
<div className='p-4 shadow rounded bg-black'>
<p className='text-yellow-500'>with Tailwind CSS</p>
<>
<nav
className='flex items-center justify-between flex-wrap p-6 rounded-lg mb-4'
style={{ backgroundColor: 'rgb(54,188,238)' }}
>
<div className='flex items-center flex-shrink-0 text-white mr-4'>
<img src='/logo.svg' style={{ height: 80 }} />
</div>
{/* <div className="block lg:hidden">
<button className="flex items-center px-3 py-2 border rounded text-teal-200 border-teal-400 hover:text-white hover:border-white">
<svg className="fill-current h-3 w-3" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><title>Menu</title><path d="M0 3h20v2H0V3zm0 6h20v2H0V9zm0 6h20v2H0v-2z"/></svg>
</button>
</div> */}
<div className='w-full block flex-grow lg:flex lg:items-center lg:w-auto'>
<div className='text-xl lg:flex-grow font-semibold'>
<a
href='/'
className='block mt-4 lg:inline-block lg:mt-0 text-teal-200 hover:text-teal-100 mr-4'
>
Dashboard
</a>
<a
href='/settings'
className='block mt-4 lg:inline-block lg:mt-0 text-white hover:text-teal-200 mr-4'
>
Settings
</a>
</div>
<div>
<a
onClick={() => console.log('Scan')}
href='#'
className='inline-block text-sm px-4 py-2 leading-none border rounded text-white border-white hover:border-transparent hover:text-teal-500 hover:bg-white mt-4 lg:mt-0'
>
Find my lifeinabox
</a>
</div>
</div>
</nav>
<div className='grid grid-cols-3 gap-4'>
<div className='p-4 shadow rounded bg-white text-center shadow-lg'></div>
<div className='p-4 shadow rounded bg-white text-center'>
<h1 className='text-purple-500 leading-relaxed'>lifeinaweb</h1>
</div>
<div className='p-4 shadow rounded bg-white text-center'>
<h1 className='text-purple-500 leading-relaxed'>lifeinaweb</h1>
</div>
<div className='p-4 shadow rounded bg-white text-center'>
<h1 className='text-purple-500 leading-relaxed'>lifeinaweb</h1>
</div>
<div className='p-4 shadow rounded bg-white text-center'>
<h1 className='text-purple-500 leading-relaxed'>logo</h1>
</div>
<div className='p-4 shadow rounded bg-white text-center'>
<h1 className='text-purple-500 leading-relaxed'>lifeinaweb</h1>
</div>
<div className='p-4 shadow rounded bg-white text-center'>
<h1 className='text-purple-500 leading-relaxed'>lifeinaweb</h1>
</div>
<div className='p-4 shadow rounded bg-white text-center'>
<h1 className='text-purple-500 leading-relaxed'>lifeinaweb</h1>
</div>
<div className='p-4 shadow rounded bg-white text-center'>
<h1 className='text-purple-500 leading-relaxed'>lifeinaweb</h1>
</div>
</div>
</div>
</>
)
68 changes: 68 additions & 0 deletions pages/settings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import '../styles/index.css'

export default () => (
<>
<nav
className='flex items-center justify-between flex-wrap p-6 rounded-lg mb-4'
style={{ backgroundColor: 'rgb(54,188,238)' }}
>
<div className='flex items-center flex-shrink-0 text-white mr-4'>
<img src='/logo.svg' style={{ height: 80 }} />
</div>
{/* <div className="block lg:hidden">
<button className="flex items-center px-3 py-2 border rounded text-teal-200 border-teal-400 hover:text-white hover:border-white">
<svg className="fill-current h-3 w-3" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><title>Menu</title><path d="M0 3h20v2H0V3zm0 6h20v2H0V9zm0 6h20v2H0v-2z"/></svg>
</button>
</div> */}
<div className='w-full block flex-grow lg:flex lg:items-center lg:w-auto'>
<div className='text-xl lg:flex-grow font-semibold'>
<a
href='/'
className='block mt-4 lg:inline-block lg:mt-0 text-white hover:text-teal-200 mr-4'
>
Dashboard
</a>
<a
href='/settings'
className='block mt-4 lg:inline-block lg:mt-0 text-teal-200 hover:text-teal-100 mr-4'
>
Settings
</a>
</div>
<div>
<a className='inline-block text-sm px-4 py-2 leading-none border rounded text-white border-white hover:border-transparent hover:text-teal-500 hover:bg-white mt-4 lg:mt-0 opacity-50 cursor-not-allowed'>
Find my lifeinabox
</a>
</div>
</div>
</nav>
{/* <div className='grid grid-cols-3 gap-4'>
<div className='p-4 shadow rounded bg-white text-center shadow-lg'>
</div>
<div className='p-4 shadow rounded bg-white text-center'>
<h1 className='text-purple-500 leading-relaxed'>lifeinaweb</h1>
</div>
<div className='p-4 shadow rounded bg-white text-center'>
<h1 className='text-purple-500 leading-relaxed'>lifeinaweb</h1>
</div>
<div className='p-4 shadow rounded bg-white text-center'>
<h1 className='text-purple-500 leading-relaxed'>lifeinaweb</h1>
</div>
<div className='p-4 shadow rounded bg-white text-center'>
<h1 className='text-purple-500 leading-relaxed'>logo</h1>
</div>
<div className='p-4 shadow rounded bg-white text-center'>
<h1 className='text-purple-500 leading-relaxed'>lifeinaweb</h1>
</div>
<div className='p-4 shadow rounded bg-white text-center'>
<h1 className='text-purple-500 leading-relaxed'>lifeinaweb</h1>
</div>
<div className='p-4 shadow rounded bg-white text-center'>
<h1 className='text-purple-500 leading-relaxed'>lifeinaweb</h1>
</div>
<div className='p-4 shadow rounded bg-white text-center'>
<h1 className='text-purple-500 leading-relaxed'>lifeinaweb</h1>
</div>
</div> */}
</>
)
Binary file added public/background-lifeina-web.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
63 changes: 63 additions & 0 deletions public/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions store/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { createStore } from 'easy-peasy' // 👈 import
import storeModel from '../model'

export function initializeStore (initialState) {
return createStore(storeModel, initialState)
}
1 change: 1 addition & 0 deletions styles/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
@import "tailwindcss/utilities"; */

body {
background-image: url("/background-lifeina-web.png");
@apply bg-blue-500 p-12;
}
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7408,6 +7408,11 @@ neo-async@^2.5.0, neo-async@^2.6.0, neo-async@^2.6.1:
resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.1.tgz#ac27ada66167fa8849a6addd837f6b189ad2081c"
integrity sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw==

next-redux-wrapper@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/next-redux-wrapper/-/next-redux-wrapper-4.0.1.tgz#70f2d83b5bd0fb07ec19e6e70bea6b179d295fd7"
integrity sha512-aj9s4VT062hvrU8k2OQevf6iffHSIXpDXtIA8xbLzfpP94h3w7vZCmAJmbmfq3rXignqJT3KG44GODwsCQmdsA==

next-tick@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c"
Expand Down

0 comments on commit aeece46

Please sign in to comment.