Skip to content

Commit ff24bac

Browse files
ashika01ebrillhart
authored andcommitted
apply styles to child in SlideSet (FormidableLabs#669)
1 parent 8ef60e9 commit ff24bac

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

README.md

+12
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,18 @@ The slide tag represents each slide in the presentation. Giving a slide tag an `
512512
| transitionOut | PropTypes.array | Specifies the slide transition when the slide exits. Accepts the same values as transition. | Set by `Deck`'s `transition` prop |
513513
| transitionDuration | PropTypes.number | Accepts integer value in milliseconds for slide transition duration. | Set by `Deck`'s `transition` prop |
514514

515+
#### SlideSet
516+
517+
With `SlideSet`, you can wrap multiple slide in it to apply the same style.
518+
519+
```jsx
520+
<SlideSet style={{ border: '2px solid red' }}>
521+
<Slide>Slide1</Slide>
522+
<Slide>Slide2</Slide>
523+
<Slide>Slide3</Slide>
524+
</SlideSet>
525+
```
526+
515527
<a name="transition-function"></a>
516528

517529
##### Transition Function

example/src/index.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,10 @@ const myCode = (is, great) => 'for' + 'sharing';
366366
</Heading>
367367
<Notes>So smooth</Notes>
368368
</Slide>
369-
<SlideSet>
370-
<Slide transition={['fade']} bgColor="secondary" textColor="primary">
369+
<SlideSet
370+
style={{ backgroundColor: 'blue', border: '10px solid cyan' }}
371+
>
372+
<Slide transition={['fade']} textColor="tertiary">
371373
<List>
372374
<Appear>
373375
<ListItem>Inline style based theme system</ListItem>

src/components/slide.js

+1
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ class Slide extends React.PureComponent {
103103
exportMode={this.props.export}
104104
printMode={this.props.print}
105105
background={this.context.styles.global.body.background}
106+
style={this.props.style}
106107
styles={{
107108
base: getStyles.call(this),
108109
presenter: presenterStyle

src/utils/slides.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ export const getSlideByIndex = (children, slideReference, index) => {
3030
const setChildren = Children.toArray(
3131
children[reference.rootIndex].props.children
3232
);
33-
slide = setChildren[reference.setIndex];
33+
const style = children[reference.rootIndex].props.style;
34+
slide = cloneElement(setChildren[reference.setIndex], {
35+
style
36+
});
3437
}
3538
}
3639
return slide;

0 commit comments

Comments
 (0)