├── .babelrc ├── .gitignore ├── README.md ├── package.json ├── src ├── components │ ├── App.js │ └── Code.js ├── index.html ├── index.js ├── slides │ ├── Slide01.js │ ├── Slide02.js │ ├── Slide03.js │ ├── Slide04.js │ ├── Slide05.js │ ├── Slide06.js │ ├── Slide07.js │ └── Slide08.js └── static │ └── react.png ├── webpack.config.js └── yarn.lock /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "es2015", 4 | "react", 5 | "stage-0" 6 | ], 7 | "plugins": [] 8 | } 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | node_modules 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # bespoke-react 2 | 3 | > Bootstrap project for easily generate [Bespoke](https://github.com/bespokejs/bespoke) presentations using React 4 | 5 | ## I want to create my own presentation 6 | Great! That's pretty easy. All you have to do is: 7 | 8 | ```sh 9 | # First, clone this repo 10 | git clone git@github.com:diegomura/bespoke-react.git 11 | 12 | # Navigate to the project and delete the git history 13 | cd bespoke-react 14 | rm -rf .git 15 | 16 | # Install the dependencies 17 | npm install 18 | 19 | # Initialize the development server 20 | npm start 21 | ``` 22 |

* you can use Yarn instead of npm if you prefer

23 | 24 | ## Creating a new slide 25 | All you need to do is creating a new `SlideXX.js` file into the `slides` directory and leave the rest to bespoke-react (being `XX` consecutive ascending numbers). Your slide will be _automagically_ added to the presentation in the order you specified. Remember that to make it work, each file should export a valid React component: 26 | 27 | ```jsx 28 | import React from 'react'; 29 | 30 | const Slide01 = () => ( 31 |
Slide 1
32 | ); 33 | 34 | export default Slide01; 35 | ``` 36 | 37 | _bespoke-react will use the file names to order the slides, so it's important to name the files correctly_ 38 | 39 | ## Accessing the Bespoke instance 40 | Each Slide component will receive the Bespoke instance via the `deck` prop. You can use it for a fine-grained control of the slides flow or events handling. 41 | 42 | ```jsx 43 | import React from 'react'; 44 | 45 | const Slide01 = ({ deck }) => ( 46 |
47 | 50 |
51 | ); 52 | 53 | export default Slide01; 54 | ``` 55 | 56 | For more information of what can be done, you can read more about the instance API and Events in the [official Bespoke documentation](https://github.com/bespokejs/bespoke#deck-instances). 57 | 58 | ## Setup Bespoke 59 | This project tries to be the more _unopinionated_ as possible. This means letting you define what Bespoke plugins and themes you want to use. To add a new plugin, just go to your `src/index.js` and add one more element to the `plugins` array: 60 | 61 | ```js 62 | import somePlugin from 'some-plugin'; 63 | 64 | const plugins = [ 65 | // ... more plugins 66 | somePlugin(), 67 | ]; 68 | ``` 69 | 70 | ## Building 71 | To build the project, just run: 72 | 73 | ```sh 74 | npm run build 75 | # or 76 | yarn build 77 | ``` 78 | 79 | You will see the output in the `dist` folder of your project. 80 | 81 | ## Deploying to Github pages 82 | Github pages is a great way of quickly share your presentations and code all together. That's why bespoke-react is shipped with a script to easily deploy your current code to your Github repo page. Just: 83 | 84 | ```sh 85 | npm run deploy 86 | #or 87 | yarn deploy 88 | ``` 89 | 90 | You should be able to see your presentation online when this finishes executing. 91 | 92 | ## License 93 | MIT © [Diego Muracciole](http://github.com/diegomura) 94 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bespoke-react", 3 | "version": "0.1.0", 4 | "main": "src/index.js", 5 | "author": "Diego Muracciole ", 6 | "license": "MIT", 7 | "scripts": { 8 | "build": "rimraf dist && webpack -p", 9 | "start": "webpack-dev-server", 10 | "deploy": "npm run build && gh-pages-deploy" 11 | }, 12 | "devDependencies": { 13 | "babel-cli": "^6.26.0", 14 | "babel-loader": "^7.1.2", 15 | "babel-preset-es2015": "^6.24.1", 16 | "babel-preset-react": "^6.24.1", 17 | "babel-preset-stage-0": "^6.24.1", 18 | "file-loader": "^1.1.5", 19 | "gh-pages-deploy": "^0.4.2", 20 | "html-webpack-plugin": "^2.30.1", 21 | "rimraf": "^2.6.2", 22 | "webpack": "^3.8.1", 23 | "webpack-dev-server": "^2.9.3" 24 | }, 25 | "dependencies": { 26 | "bespoke": "^1.1.0", 27 | "bespoke-bullets": "^1.1.0", 28 | "bespoke-classes": "^1.0.0", 29 | "bespoke-keys": "^1.1.0", 30 | "bespoke-prism": "^1.0.1", 31 | "bespoke-progress": "^1.0.0", 32 | "bespoke-theme-cube": "^2.0.1", 33 | "bespoke-touch": "^1.0.0", 34 | "react": "^16.0.0", 35 | "react-dom": "^16.0.0" 36 | }, 37 | "gh-pages-deploy": { 38 | "staticpath": "dist", 39 | "noprompt": true 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/components/App.js: -------------------------------------------------------------------------------- 1 | // ------------------------------------ 2 | // DO NOT EDIT OR DELETE THIS COMPONENT 3 | // ------------------------------------ 4 | 5 | import React from 'react'; 6 | import bespoke from 'bespoke'; 7 | 8 | const req = require.context("../slides", true, /\.js$/); 9 | const slides = req.keys().map(key => req(key)); 10 | 11 | class App extends React.Component { 12 | constructor(props) { 13 | super(props); 14 | 15 | this.state = { 16 | deck: null, 17 | currentSlide: 0, 18 | }; 19 | } 20 | 21 | componentDidMount() { 22 | const { mountElement, plugins } = this.props; 23 | 24 | const deck = bespoke.from(mountElement, plugins); 25 | 26 | deck.on('activate', event => { 27 | this.setState({ currentSlide: event.index }); 28 | return true; 29 | }) 30 | 31 | this.setState({ deck }) 32 | } 33 | 34 | render() { 35 | const { deck, currentSlide } = this.state; 36 | 37 | return ( 38 | slides.map((slide, i) => { 39 | const Slide = slide.default; 40 | 41 | return 46 | }) 47 | ); 48 | } 49 | } 50 | 51 | export default App; 52 | -------------------------------------------------------------------------------- /src/components/Code.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | const Code = ({ language, style, className, children }) => ( 4 |
 5 |     
 6 |       {children.replace(/  +/g, '').trim()}
 7 |     
 8 |   
9 | ); 10 | 11 | export default Code; 12 | -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import cube from 'bespoke-theme-cube'; 4 | import classes from 'bespoke-classes'; 5 | import keys from 'bespoke-keys'; 6 | import touch from 'bespoke-touch'; 7 | import progress from 'bespoke-progress'; 8 | import bullets from 'bespoke-bullets'; 9 | import prism from 'bespoke-prism'; 10 | import App from './components/App'; 11 | 12 | const MOUNT_ELEMENT = document.getElementById('root'); 13 | 14 | const plugins = [ 15 | cube(), 16 | classes(), 17 | keys(), 18 | touch(), 19 | progress(), 20 | bullets('li'), 21 | prism(), 22 | ]; 23 | 24 | ReactDOM.render( 25 | , 29 | MOUNT_ELEMENT 30 | ); 31 | -------------------------------------------------------------------------------- /src/slides/Slide01.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | const Slide01 = () => ( 4 |
5 |

bespoke-react

6 |

Bespoke + React made easy

7 |