24 | );
25 | }
26 |
27 | export default P;
28 |
--------------------------------------------------------------------------------
/src/components/reveal.js:
--------------------------------------------------------------------------------
1 | import React, { useEffect } from 'react';
2 | import Reveal from 'reveal.js';
3 |
4 | // Styles
5 | import 'reveal.js/dist/reveal.css';
6 |
7 | function RevealJS({
8 | children,
9 |
10 | plugins = [],
11 |
12 | // Display presentation control arrows
13 | controls = true,
14 |
15 | // Help the user learn the controls by providing hints, for example by
16 | // bouncing the down arrow when they first encounter a vertical slide
17 | controlsTutorial = true,
18 |
19 | // Determines where controls appear, "edges" or "bottom-right"
20 | controlsLayout = 'bottom-right',
21 |
22 | // Visibility rule for backwards navigation arrows; "faded", "hidden"
23 | // or "visible"
24 | controlsBackArrows = 'faded',
25 |
26 | // Display a presentation progress bar
27 | progress = true,
28 |
29 | // Display the page number of the current slide
30 | // - true = Show slide number
31 | // - false = Hide slide number
32 | //
33 | // Can optionally be set as a string that specifies the number formatting =
34 | // - "h.v" = Horizontal . vertical slide number (default)
35 | // - "h/v" = Horizontal / vertical slide number
36 | // - "c" = Flattened slide number
37 | // - "c/t" = Flattened slide number / total slides
38 | //
39 | // Alternatively, you can provide a function that returns the slide
40 | // number for the current slide. The function should take in a slide
41 | // object and return an array with one string [slideNumber] or
42 | // three strings [n1,delimiter,n2]. See #formatSlideNumber().
43 | slideNumber = false,
44 |
45 | // Can be used to limit the contexts in which the slide number appears
46 | // - "all" = Always show the slide number
47 | // - "print" = Only when printing to PDF
48 | // - "speaker" = Only in the speaker view
49 | showSlideNumber = 'all',
50 |
51 | // Use 1 based indexing for # links to match slide number (default is zero
52 | // based)
53 | hashOneBasedIndex = false,
54 |
55 | // Add the current slide number to the URL hash so that reloading the
56 | // page/copying the URL will return you to the same slide
57 | hash = false,
58 |
59 | // Flags if we should monitor the hash and change slides accordingly
60 | respondToHashChanges = true,
61 |
62 | // Push each slide change to the browser history. Implies `hash = true`
63 | history = false,
64 |
65 | // Enable keyboard shortcuts for navigation
66 | keyboard = true,
67 |
68 | // Optional function that blocks keyboard events when retuning false
69 | //
70 | // If you set this to 'foucsed', we will only capture keyboard events
71 | // for embdedded decks when they are in focus
72 | keyboardCondition = null,
73 |
74 | // Disables the default reveal.js slide layout (scaling and centering)
75 | // so that you can use custom CSS layout
76 | disableLayout = false,
77 |
78 | // Enable the slide overview mode
79 | overview = true,
80 |
81 | // Vertical centering of slides
82 | center = true,
83 |
84 | // Enables touch navigation on devices with touch input
85 | touch = true,
86 |
87 | // Loop the presentation
88 | loop = false,
89 |
90 | // Change the presentation direction to be RTL
91 | rtl = false,
92 |
93 | // Changes the behavior of our navigation directions.
94 | //
95 | // "default"
96 | // Left/right arrow keys step between horizontal slides, up/down
97 | // arrow keys step between vertical slides. Space key steps through
98 | // all slides (both horizontal and vertical).
99 | //
100 | // "linear"
101 | // Removes the up/down arrows. Left/right arrows step through all
102 | // slides (both horizontal and vertical).
103 | //
104 | // "grid"
105 | // When this is enabled, stepping left/right from a vertical stack
106 | // to an adjacent vertical stack will land you at the same vertical
107 | // index.
108 | //
109 | // Consider a deck with six slides ordered in two vertical stacks =
110 | // 1.1 2.1
111 | // 1.2 2.2
112 | // 1.3 2.3
113 | //
114 | // If you're on slide 1.3 and navigate right, you will normally move
115 | // from 1.3 -> 2.1. If "grid" is used, the same navigation takes you
116 | // from 1.3 -> 2.3.
117 | navigationMode = 'default',
118 |
119 | // Randomizes the order of slides each time the presentation loads
120 | shuffle = false,
121 |
122 | // Turns fragments on and off globally
123 | fragments = true,
124 |
125 | // Flags whether to include the current fragment in the URL,
126 | // so that reloading brings you to the same fragment position
127 | fragmentInURL = true,
128 |
129 | // Flags if the presentation is running in an embedded mode,
130 | // i.e. contained within a limited portion of the screen
131 | embedded = false,
132 |
133 | // Flags if we should show a help overlay when the question-mark
134 | // key is pressed
135 | help = true,
136 |
137 | // Flags if it should be possible to pause the presentation (blackout)
138 | pause = true,
139 |
140 | // Flags if speaker notes should be visible to all viewers
141 | showNotes = false,
142 |
143 | // Global override for autolaying embedded media (video/audio/iframe)
144 | // - null = Media will only autoplay if data-autoplay is present
145 | // - true = All media will autoplay, regardless of individual setting
146 | // - false = No media will autoplay, regardless of individual setting
147 | autoPlayMedia = null,
148 |
149 | // Global override for preloading lazy-loaded iframes
150 | // - null = Iframes with data-src AND data-preload will be loaded when within
151 | // the viewDistance, iframes with only data-src will be loaded when visible
152 | // - true = All iframes with data-src will be loaded when within the viewDistance
153 | // - false = All iframes with data-src will be loaded only when visible
154 | preloadIframes = null,
155 |
156 | // Can be used to globally disable auto-animation
157 | autoAnimate = true,
158 |
159 | // Optionally provide a custom element matcher that will be
160 | // used to dictate which elements we can animate between.
161 | autoAnimateMatcher = null,
162 |
163 | // Default settings for our auto-animate transitions, can be
164 | // overridden per-slide or per-element via data arguments
165 | autoAnimateEasing = 'ease',
166 | autoAnimateDuration = 1.0,
167 | autoAnimateUnmatched = true,
168 |
169 | // CSS properties that can be auto-animated. Position & scale
170 | // is matched separately so there's no need to include styles
171 | // like top/right/bottom/left, width/height or margin.
172 | autoAnimateStyles = [
173 | 'opacity',
174 | 'color',
175 | 'background-color',
176 | 'padding',
177 | 'font-size',
178 | 'line-height',
179 | 'letter-spacing',
180 | 'border-width',
181 | 'border-color',
182 | 'border-radius',
183 | 'outline',
184 | 'outline-offset',
185 | ],
186 |
187 | // Controls automatic progression to the next slide
188 | // - 0 = Auto-sliding only happens if the data-autoslide HTML attribute
189 | // is present on the current slide or fragment
190 | // - 1+ = All slides will progress automatically at the given interval
191 | // - false = No auto-sliding, even if data-autoslide is present
192 | autoSlide = 0,
193 |
194 | // Stop auto-sliding after user input
195 | autoSlideStoppable = true,
196 |
197 | // Use this method for navigation when auto-sliding (defaults to navigateNext)
198 | autoSlideMethod = null,
199 |
200 | // Specify the average time in seconds that you think you will spend
201 | // presenting each slide. This is used to show a pacing timer in the
202 | // speaker view
203 | defaultTiming = null,
204 |
205 | // Enable slide navigation via mouse wheel
206 | mouseWheel = false,
207 |
208 | // Opens links in an iframe preview overlay
209 | // Add `data-preview-link` and `data-preview-link="false"` to customise each link
210 | // individually
211 | previewLinks = false,
212 |
213 | // Exposes the reveal.js API through window.postMessage
214 | postMessage = true,
215 |
216 | // Dispatches all reveal.js events to the parent window through postMessage
217 | postMessageEvents = false,
218 |
219 | // Focuses body when page changes visibility to ensure keyboard shortcuts work
220 | focusBodyOnPageVisibilityChange = true,
221 |
222 | // Transition style
223 | transition = 'slide', // none/fade/slide/convex/concave/zoom
224 |
225 | // Transition speed
226 | transitionSpeed = 'default', // default/fast/slow
227 |
228 | // Transition style for full page slide backgrounds
229 | backgroundTransition = 'fade', // none/fade/slide/convex/concave/zoom
230 |
231 | // The maximum number of pages a single slide can expand onto when printing
232 | // to PDF, unlimited by default
233 | pdfMaxPagesPerSlide = Number.POSITIVE_INFINITY,
234 |
235 | // Prints each fragment on a separate slide
236 | pdfSeparateFragments = true,
237 |
238 | // Offset used to reduce the height of content within exported PDF pages.
239 | // This exists to account for environment differences based on how you
240 | // print to PDF. CLI printing options, like phantomjs and wkpdf, can end
241 | // on precisely the total height of the document whereas in-browser
242 | // printing has to end one pixel before.
243 | pdfPageHeightOffset = -1,
244 |
245 | // Number of slides away from the current that are visible
246 | viewDistance = 3,
247 |
248 | // Number of slides away from the current that are visible on mobile
249 | // devices. It is advisable to set this to a lower number than
250 | // viewDistance in order to save resources.
251 | mobileViewDistance = 2,
252 |
253 | // The display mode that will be used to show slides
254 | display = 'block',
255 |
256 | // Hide cursor if inactive
257 | hideInactiveCursor = true,
258 |
259 | // Time before the cursor is hidden (in ms)
260 | hideCursorTime = 5000,
261 |
262 | // Parallax background image
263 | parallaxBackgroundImage = '', // e.g. "https://s3.amazonaws.com/hakim-static/reveal-js/reveal-parallax-1.jpg"
264 |
265 | // Parallax background size
266 | parallaxBackgroundSize = '', // CSS syntax, e.g. "2100px 900px" - currently only pixels are supported (don't use % or auto)
267 |
268 | // Number of pixels to move the parallax background per slide
269 | // - Calculated automatically unless specified
270 | // - Set to 0 to disable movement along an axis
271 | parallaxBackgroundHorizontal = 200,
272 | parallaxBackgroundVertical = 50,
273 |
274 | // The "normal" size of the presentation, aspect ratio will
275 | // be preserved when the presentation is scaled to fit different
276 | // resolutions. Can be specified using percentage units.
277 | width = 960,
278 | height = 700,
279 |
280 | // Factor of the display size that should remain empty around
281 | // the content
282 | margin = 0.04,
283 |
284 | // Bounds for smallest/largest possible scale to apply to content
285 | minScale = 0.2,
286 | maxScale = 2.0,
287 | }) {
288 | useEffect(() => {
289 | const deck = new Reveal({
290 | plugins,
291 |
292 | controls,
293 | controlsTutorial,
294 | controlsLayout,
295 | controlsBackArrows,
296 | progress,
297 | slideNumber,
298 | showSlideNumber,
299 | hashOneBasedIndex,
300 | hash,
301 | respondToHashChanges,
302 | history,
303 | keyboard,
304 | keyboardCondition,
305 | disableLayout,
306 | overview,
307 | center,
308 | touch,
309 | loop,
310 | rtl,
311 | navigationMode,
312 | shuffle,
313 | fragments,
314 | fragmentInURL,
315 | embedded,
316 | help,
317 | pause,
318 | showNotes,
319 | autoPlayMedia,
320 | preloadIframes,
321 | autoAnimate,
322 | autoAnimateMatcher,
323 | autoAnimateEasing,
324 | autoAnimateDuration,
325 | autoAnimateUnmatched,
326 | autoAnimateStyles,
327 | autoSlide,
328 | autoSlideStoppable,
329 | autoSlideMethod,
330 | defaultTiming,
331 | mouseWheel,
332 | previewLinks,
333 | postMessage,
334 | postMessageEvents,
335 | focusBodyOnPageVisibilityChange,
336 | transition,
337 | transitionSpeed,
338 | backgroundTransition,
339 | pdfMaxPagesPerSlide,
340 | pdfSeparateFragments,
341 | pdfPageHeightOffset,
342 | viewDistance,
343 | mobileViewDistance,
344 | display,
345 | hideInactiveCursor,
346 | hideCursorTime,
347 | parallaxBackgroundImage,
348 | parallaxBackgroundSize,
349 | parallaxBackgroundHorizontal,
350 | parallaxBackgroundVertical,
351 | width,
352 | height,
353 | margin,
354 | minScale,
355 | maxScale,
356 | });
357 |
358 | deck.initialize();
359 | });
360 |
361 | return