Git Product home page Git Product logo

wdrslides's Introduction

Travis npm package Coverage Status

wdrslides

Webpack Driven React Slides is a set of lightweight react components to create presentations.

Installation

Add the package from npm repository via

npm i -S wdrslides

or

yarn add wdrslides

Usage

wdrslides syntax is super simple. Your first presentation could be as simple as:

import React from 'react'
import {render} from 'react-dom'
import {
	Presentation,
	KeyboardControls,
	Canvas,
	Slide
} from 'wdrslides' // import the basic elements

const presentation = (
	<Presentation>
		<KeyboardControls />
		<Canvas aspectRatio={4 / 3}>
			<Slide>
				<h1>Hello World!</h1>
			</Slide>
			<Slide>
				<h1>Thank You and Goodbye!</h1>
			</Slide>
		</Canvas>
	</Presentation>
)

render(presentation, document.getElementById('root'))

Your index.html should look something like this:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Presentation Title</title>
		<style type="text/css">
		body {  // increase font size, make background dark
			font-size: 2em;
			background-color: black;
		}

		#root { // use all of the available space
			position: absolute;
			top:0;
			right:0;
			bottom:0;
			left:0;
		}

		.stage { // set presentation background and border
			border: 1px solid #2d4759;
			background-color: #fff;
		}
		</style>
  </head>
  <body>
    <div id='root'/>
  </body>
</html>

Keyboard Navigation

The KeyboardControls component adds event listeners to key presses. It allows navigation with the arrow, space and backspace keys.

Mouse Navigation

Keyboard control doesn't do the trick for you? Add navigation buttons like this:

<ProgressBar />
<div className="navigation">
	<NavButton action="backward">«</NavButton>
	<Progress />
	<NavButton action="forward">»</NavButton>
</div>

Add styles to your index.html

.progressbar {
	height: 5px;
	background-color: #7dcbff;
	transition: width 0.5s ease-in-out;
	top: 100%;
	position: absolute;
	transform: translateY(-5px);
}

.navigation {
	z-index: 999;
	width: 100%;
	text-align: right;
	position: absolute;
	top: 100%;
	transform: translateY(-100%);
	font-size: 1em;
}

Full Example

See the demo branch of this repository.

Extend

If you wish to add external content to your slides you can use various loaders for webpack. I recommend taking a look at markdown-loader and html-loader.

You can also extend wdrslides however you wish. To get started you may want to look at the Progress components.

wdrslides's People

Contributors

konqi avatar

Stargazers

Andrey Vetlugin avatar

Watchers

James Cloos avatar

Forkers

digideskio

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.