1.0.12 • Published 2 years ago

@frank-mayer/slix v1.0.12

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

slix

React powered Slides Framework

Demo

Installation

npm install @frank-mayer/slix react react-dom framer-motion

Use a bundler like parcel or webpack to bundle your code.

Usage

  1. Create a index.html file without any content in its body.
  2. Link your index.tsx file.
<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  </head>
  <body>
    <script src="index.tsx" type="module"></script>
  </body>
</html>
  1. Call the slix function with the slides you want to be rendered. This function returns a Promise to the Slix instance, which you can use to control the slides. The Promise resolves when the first slide is rendered.
  2. Add a controller to the slix instance, this includes basic navigation features. You can add multiple controllers to a Slix instance. Base class is BaseController, you can extend it to create your own controller.
  3. You can use the included style reset by calling the resetCss function if you want to.
import { slix, resetCss, ArrowController, Slide } from "@frank-mayer/slix";

slix({
  slides: new Map([
    [
      1,
      <Slide>
        <h1>Slide 1</h1>
      </Slide>,
    ],
    [
      2,
      <Slide>
        <h1>Slide 2</h1>
      </Slide>,
    ],
    [
      3,
      <Slide>
        <h1>Slide 3</h1>
      </Slide>,
    ],
    [
      4,
      <Slide>
        <h1>Slide 4</h1>
      </Slide>,
    ],
  ]),
  initialSlide: 1,
}).then((slixInstance) => {
  ArrowController.attach(slixInstance);
});

resetCss();

Dependencies

Recommended Libraries

Controllers

ArrowController

KeyAction
Next slide
Previous slide

PowerPointController

KeyAction
Next slide
SpaceNext slide
Previous slide

Keyboard controls

KeyAction
.Open control panel
fStart fullscreen

State

If you open the control panel, the new window has a new React instance and therefore a new state. This means that the state of the control panel is not the same as the state of the main window.

To sync the state, you can use the useState hook from Slix. This hook needs a key to identify which state you want to sync. The hook returns a object with a property value.

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago