Skip to content

Instantly share code, notes, and snippets.

View bietkul's full-sized avatar

Kuldeep Saxena bietkul

View GitHub Profile
@bietkul
bietkul / store.js
Last active February 11, 2019 20:54
Create Redux store with Next.js
import {
createStore, applyMiddleware, compose, combineReducers,
} from 'redux';
import thunkMiddleware from 'redux-thunk';
import reducer from '../modules/reducers';
let store = null;
const reducers = combineReducers(reducer);
@bietkul
bietkul / counter.js
Created February 11, 2019 18:18
Counter example with Redux
import { createStore } from 'redux'
/**
* This is a reducer, a pure function with (state, action) => state signature.
* It describes how an action transforms the state into the next state.
*
* The shape of the state is up to you: it can be a primitive, an array, an object,
* or even an Immutable.js data structure. The only important part is that you should
* not mutate the state object, but return a new object if the state changes.
*
@bietkul
bietkul / home.js
Last active February 1, 2019 22:09
Appbase.io Movies Store
import React from 'react';
import Link from 'next/link';
import { Button } from 'antd';
import { css } from '@emotion/core';
import {
Content, Footer, Header, Container,
} from '../components/Layout';
const mainCls = css`
max-width: 1000px;
@bietkul
bietkul / RightMenu.js
Created February 1, 2019 21:13
Appbae.io Movies Store
import React from 'react';
import { string } from 'prop-types';
import Link from 'next/link';
import { Menu } from 'antd';
const RightMenu = ({ mode }) => (
<Menu mode={mode}>
<Menu.Item key="search">
<Link href="/search">Search</Link>
</Menu.Item>
@bietkul
bietkul / LeftMenu.js
Created February 1, 2019 21:05
Appbase.io Movies Store
import React from 'react';
import { Menu } from 'antd';
import Link from 'next/link';
const LeftMenu = () => (
<Menu mode="horizontal">
<Menu.Item key="new_movies">
<Link href="new-movies">New Movies</Link>
</Menu.Item>
</Menu>
@bietkul
bietkul / styles.js
Last active February 1, 2019 21:28
Appbase.io Movies Store
import { css } from '@emotion/core';
export const headerCls = css`
background-color: #04070b;
box-shadow: 0 1px 10px 0 rgba(0, 0, 0, 0.1);
ul {
background-color: #04070b;
li {
cursor: pointer;
color: #fff;
@bietkul
bietkul / .babelrc
Created February 1, 2019 20:25
Appbase.io Movies Store
{
"presets": ["@emotion/babel-preset-css-prop"],
"plugins": [
["import", { "libraryName": "antd", "style": "css" }],
"@babel/plugin-proposal-class-properties"
]
}
@bietkul
bietkul / Footer.js
Created February 1, 2019 20:23
Appbase.io Movies Store
@bietkul
bietkul / Content.js
Created February 1, 2019 20:22
Appbase.io Movies Store
import React from 'react';
import { node, string, oneOfType } from 'prop-types';
import { Layout } from 'antd';
const AppContent = Layout.Content;
const Content = ({ children, ...props }) =>
<AppContent {...props}>{children}</AppContent>;
Content.propTypes = {
children: oneOfType([node, string]),
};
export default Content;
@bietkul
bietkul / Header.js
Created February 1, 2019 20:20
Appbase.io Movies Store
import React, { Component } from 'react';
import { Button, Drawer } from 'antd';
import Link from 'next/link';
import { headerCls, drawerCls } from './styles';
import LeftMenu from './LeftMenu';
import RightMenu from './RightMenu';
class Header extends Component {
state = {
visible: false,