You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -34,6 +35,8 @@ ReactJS based Presentation Library
34
35
-[Fill](#fill)
35
36
-[Markdown Tag](#markdown-tag)
36
37
-[Markdown](#markdown)
38
+
-[Magic Tag](#magic-tag)
39
+
-[Magic](#magic)
37
40
-[Element Tags](#element-tags)
38
41
-[Appear](#appear)
39
42
-[BlockQuote, Quote and Cite (Base)](#blockquote-quote-and-cite-base)
@@ -284,7 +287,7 @@ import createTheme from "spectacle/lib/themes/default";
284
287
285
288
Or create your own based upon the source.
286
289
287
-
`index.js` is what you would edit in order to create a custom theme of your own, using ReactJS style inline style objects.
290
+
`index.js` is what you would edit in order to create a custom theme of your own, using object based styles.
288
291
289
292
You will want to edit `index.html` to include any web fonts or additional CSS that your theme requires.
290
293
@@ -305,6 +308,43 @@ const theme = createTheme({
305
308
306
309
The returned theme object can then be passed to the `Deck` tag via the `theme` prop, and will override the default styles.
307
310
311
+
<aname="faq"></a>
312
+
## FAQ
313
+
314
+
_How can I easily style the base components for my presentation?_
315
+
316
+
Historically, custom styling in Spectacle has meant screwing with a theme file, or using gross `!important` overrides. We fixed that. Spectacle is now driven by [emotion](github.com/emotion-js/emotion), so you can bring your own styling library, whether its emotion itself, or something like styled-components or glamorous. For example, if you want to create a custom Heading style:
317
+
318
+
```javascript
319
+
importstyledfrom'styled-components';
320
+
import { Heading } from'spectacle';
321
+
322
+
constCustomHeading=styled(Heading)`
323
+
font-size: 1.2em;
324
+
color: papayawhip;
325
+
`;
326
+
```
327
+
328
+
_How can I separate my slides into other files?_
329
+
330
+
Until this release, you would have to do some array shenanigans, but now you can just wrap those slides with an element that has a special prop:
331
+
332
+
```javascript
333
+
// mySlides.js
334
+
exportdefaultclassmySlidesextendsComponent {
335
+
render() {
336
+
return (
337
+
<div hasSlideChildren>
338
+
<Slide>1</Slide>
339
+
<Slide>2</Slide>
340
+
<Slide>3</Slide>
341
+
</div>
342
+
)
343
+
}
344
+
}
345
+
346
+
```
347
+
308
348
<aname="tag-api"></a>
309
349
## Tag API
310
350
@@ -350,6 +390,11 @@ The slide tag represents each slide in the presentation. Giving a slide tag an `
350
390
|transitionOut|PropTypes.array|Specifies the slide transition when the slide exits. Accepts the same values as transition.|
351
391
|transitionDuration| PropTypes.number| Accepts integer value in milliseconds for slide transition duration.
352
392
393
+
<aname="wrapping-slides"></a>
394
+
##### Wrapping Slides
395
+
396
+
If you author your slides in another file or want any kind of grouping that requires one additional level of nesting, you can add a `hasSlideChildren` prop to their parent element. This lets Spectacle identify that it is a wrapper, and will disregard the heirarchy instead opting to read the child slides as if the wrapper was not present.
397
+
353
398
<aname="transition-function"></a>
354
399
##### Transition Function
355
400
Spectacle now supports defining custom transitions. The function prototype is `(transitioning: boolean, forward: boolean) => Object`. The `transitioning` param is true when the slide enters and exits. The `forward` param is `true` when the slide is entering, `false` when the slide is exiting. The function returns a style object. You can mix string-based transitions and functions. Styles provided when `transitioning` is `false` will appear during the lifecyle of the slide. An example is shown below:
@@ -453,6 +498,29 @@ Markdown generated tags aren't prop configurable, and instead render with your t
453
498
|---|---|---|
454
499
|source|PropTypes.string| Markdown source |
455
500
501
+
<aname="magic-tag"></a>
502
+
### Magic Tag
503
+
504
+
<aname="Magic"></a>
505
+
#### Magic
506
+
507
+
> NOTE: The Magic tag uses the Web Animations API. If you use the Magic tag and want it to work places other than Chrome, you will need to include the polyfill [https://github.com/web-animations/web-animations-js](https://github.com/web-animations/web-animations-js)
508
+
509
+
The Magic Tag is a new experimental feature that attempts to recreate Magic Move behavior that slide authors might be accustomed to coming from Keynote. It wraps slides, and transitions between positional values for child elements. This means that if you have two similar strings, we will transition common characters to their new positions. This does not transition on non positional values such as slide background color or font size.
510
+
511
+
Using Magic is pretty simple, you just wrap your slides with it, and it transitions between them:
512
+
513
+
```javascript
514
+
<Magic>
515
+
<Slide><Heading>First Heading</Heading></Slide>
516
+
<Slide><Heading>Second Heading</Heading></Slide>
517
+
</Magic>
518
+
```
519
+
520
+
Transitioning between similar states will vary based upon the input content. It will look better when there are more common elements. An upcoming patch will allow for custom keys, which will provide greater control over which elements are identified as common for reuse.
521
+
522
+
Until then, feedback is very welcome, as this is a non-trivial feature and we anticipate iterating on the behind the scenes mechanics of how it works, so that we can accommodate most use cases.
523
+
456
524
<aname="element-tags"></a>
457
525
### Element Tags
458
526
@@ -490,6 +558,8 @@ This tag displays a styled, highlighted code preview. I prefer putting my code s
490
558
|lang|PropTypes.string| Prism compatible language name. i.e: 'javascript' |
491
559
|source| PropTypes.string| String of code to be shown |
492
560
561
+
If you want to change the theme used here, you can include a prism theme in index.html via a script tag. CodePane and Playground both use the prism library under the hood, which has several themes that are available to include.
562
+
493
563
<aname="code-base"></a>
494
564
#### Code (Base)
495
565
@@ -622,7 +692,7 @@ Unordered lists:
622
692
<a name="s-base"></a>
623
693
#### S (Base)
624
694
625
-
The `S` tag is used to add inline styling to a piece of text, such as underline or strikethrough.
695
+
The `S` tag is used to add styling to a piece of text, such as underline or strikethrough.
0 commit comments