Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Browse Available Books</title>
	<link rel="shortcut icon" href="/images/title-icon.png" type="image/png">
    <link rel="stylesheet" href="<%=htmlWebpackPlugin.files.chunks.main.css %>">
  </head>
  <body>
    <body>
    <div id="root">
    </div>
	
    <script src="<%= htmlWebpackPlugin.files.chunks.main.entry %>"></script>
  </body>
</html>
            
          
!
            
              import React from 'react';
import ReactDOM from 'react-dom';
import "./scss/main.scss";
import Header from "./components/Header";
import Nav from "./components/Nav";
import Services from "./components/Services";
import General from "./components/General";

const menu = [
	{
		links: '/',
		label: 'Now Reading',
		className: 'now-reading',
		classNameList: ''
	},
	{
		links: '/',
		label: 'Browse',
		className: 'browse',
		classNameList: 'active-menu'
	},
	{
		links: '/',
		label: 'Buy Books',
		className: 'buy-book',
		classNameList: ''
	},
	{
		links: '/',
		label: 'Favourite Books',
		className: 'favorite-book',
		classNameList: ''
	},
	{
		links: '/',
		label: 'Wishlist',
		className: 'wishlist',
		classNameList: ''
	}
];
const books = [
	{
		ID: 1,
		Name: 'Jewels of Nizam',
		Author: 'by Geeta Devi',
	},
	{
		ID: 2,
		Name: 'Cakes & Bakes',
		Author: 'by Sanjeev Kapoor'
	},
	{
		ID: 3,
		Name: 'Jamie’s Kitchen',
		Author: 'by Jamie Oliver'
	},
	{
		ID: 4,
		Name: 'Inexpensive Family Meals',
		Author: 'by Simon Holst'
	},
	{
		ID: 5,
		Name: 'Paleo Slow Cooking',
		Author: 'by Chrissy Gower'
	},
	{
		ID: 6,
		Name: 'Cook Like an Italian',
		Author: 'by Tobie Puttock'
	},
	{
		ID: 7,
		Name: 'Suneeta Vaswani',
		Author: 'by Geeta Devi'
	},
	{
		ID: 8,
		Name: 'Jamie Does',
		Author: 'by Jamie Oliver'
	},
	{
		ID: 9,
		Name: 'Jamie’s italy',
		Author: 'by Jamie Oliver'
	},
	{
		ID: 10,
		Name: 'Vegetables Cookbook',
		Author: 'by Matthew Biggs'
	}
];

class App extends React.Component {
	constructor(props){
		super(props);
		this.state = {
			AllBooks: props.books,
			filteredBooks: props.books,
		}
	};

	showAllBooks() {
		const {AllBooks} = this.state;
		this.setState({filteredBooks: allBooks});
	}

	filteredByName(name) {
		const {AllBooks} = this.state;
		const filteredBooks = AllBooks.filter(book => book.Name ===name);
		this.setState({filteredBooks});
	}

	filteredByAuthoor(author) {
		const {AllBooks} = this.state;
		const filteredBooks = AllBooks.filter(book => book.Author === author)
	}



	render(){
		return(
			<div className="wrapper">
				<Header />
				<Nav action
					 showAllBooks={this.showAllBooks}
					 filterByName={this.filterByName}
					 filterByAuthor={this.filterByAuthor}
				/>
				<Services items={menu} />
				<General filteredBooks={this.state.filteredBooks} />
			</div>
		)
	}
}


ReactDOM.render(<App />, document.getElementById("root"));









import React, { Component } from "react";

class Nav extends React.Component{

	filteredByName(event) {
		const name = "One";
		this.props.filteredByName(name);

	}

	render(){
		return(
			<div className="nav">
				<div className="sort">
					<ul>
						<li>
							<a onClick={this.filterByName}>ByName</a>
						</li>
						<li>
							<a onClick={() => this.SortMostPopular}>Most Popular</a>
						</li>
						<li>
							<a onClick={() => this.SortMostRecent}>Most Recent</a>
						</li>
						<li>
							<a onClick={() => this.SortFreeBook}>Free Book</a>
						</li>
					</ul>
				</div>
				<div className="search">
					<form method="get" action="/search" className="form-search">
						<input type="text" placeholder="Enter Keywords" />
					</form>
				</div>
			</div>
		)
	}
}

export default Nav;



import React, { Component } from "react";


class General extends React.Component {

	render() {
		return (
			<div className="general">
				{this.props.filteredBooks.map((index, key) =>
					<div>
					</div>
				)}
			</div>
		)
	}
}

export default General;
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console