Skip to content

Commit

Permalink
add the next flag to all the demos in case of
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Nov 26, 2018
1 parent 9655797 commit 9aec376
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 19 deletions.
8 changes: 1 addition & 7 deletions docs/src/modules/components/Demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function getDemo(props) {
return {
title: 'Material demo',
description: props.githubLocation,
dependencies: getDependencies(props.raw, props.react),
dependencies: getDependencies(props.raw, props.demoOptions.react),
files: {
'demo.js': props.raw,
'index.js': `
Expand Down Expand Up @@ -307,19 +307,13 @@ class Demo extends React.Component {
}
}

Demo.defaultProps = {
reactVersion: 'latest',
};

Demo.propTypes = {
classes: PropTypes.object.isRequired,
demoOptions: PropTypes.object.isRequired,
githubLocation: PropTypes.string.isRequired,
index: PropTypes.number.isRequired,
js: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
raw: PropTypes.string.isRequired,
// eslint-disable-next-line react/no-unused-prop-types
reactVersion: PropTypes.string,
};

export default withStyles(styles)(Demo);
1 change: 0 additions & 1 deletion docs/src/modules/components/MarkdownDocs.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ function MarkdownDocs(props) {
key={content}
js={demos[name].js}
raw={demos[name].raw}
reactVersion={demoOptions.react}
index={index}
demoOptions={demoOptions}
githubLocation={`${SOURCE_CODE_ROOT_URL}/docs/src/${name}`}
Expand Down
10 changes: 5 additions & 5 deletions docs/src/pages/css-in-js/advanced/advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,26 @@

Add a `ThemeProvider` to the top level of your app to access the theme down the React's component tree. Then, you can access the theme object in the style functions.

{{"demo": "pages/css-in-js/advanced/Theming.js"}}
{{"demo": "pages/css-in-js/advanced/Theming.js", "react": "next"}}

## Accessing the theme in a component

You might need to access the theme variables inside your React components.

### `useTheme` hook

{{"demo": "pages/css-in-js/advanced/UseTheme.js"}}
{{"demo": "pages/css-in-js/advanced/UseTheme.js", "react": "next"}}

### `withTheme` HOC

{{"demo": "pages/css-in-js/advanced/WithTheme.js"}}
{{"demo": "pages/css-in-js/advanced/WithTheme.js", "react": "next"}}

## Theme nesting

You can nest multiple theme providers.
This can be really useful when dealing with different area of your application that have distinct appearance from each other.

{{"demo": "pages/css-in-js/advanced/ThemeNesting.js"}}
{{"demo": "pages/css-in-js/advanced/ThemeNesting.js", "react": "next"}}

## JSS plugins

Expand Down Expand Up @@ -81,7 +81,7 @@ const useStyles = makeStyles({
});
```

{{"demo": "pages/css-in-js/advanced/StringTemplates.js"}}
{{"demo": "pages/css-in-js/advanced/StringTemplates.js", "react": "next"}}

## CSS injection order

Expand Down
12 changes: 6 additions & 6 deletions docs/src/pages/css-in-js/basics/basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export default function StyledComponents() {
}
```

{{"demo": "pages/css-in-js/basics/StyledComponents.js"}}
{{"demo": "pages/css-in-js/basics/StyledComponents.js", "react": "next"}}

### Higher-order component API

Expand Down Expand Up @@ -137,7 +137,7 @@ HigherOrderComponent.propTypes = {
export default withStyles(styles)(HigherOrderComponent);
```

{{"demo": "pages/css-in-js/basics/HigherOrderComponent.js"}}
{{"demo": "pages/css-in-js/basics/HigherOrderComponent.js", "react": "next"}}

### Render props API

Expand All @@ -163,7 +163,7 @@ export default function RenderProps() {
}
```

{{"demo": "pages/css-in-js/basics/RenderProps.js"}}
{{"demo": "pages/css-in-js/basics/RenderProps.js", "react": "next"}}

## Adapting based on props

Expand All @@ -176,12 +176,12 @@ This button component has a color property that changes its color:

### Adapting styled components API

{{"demo": "pages/css-in-js/basics/AdaptingStyledComponents.js"}}
{{"demo": "pages/css-in-js/basics/AdaptingStyledComponents.js", "react": "next"}}

### Adapting higher-order component API

{{"demo": "pages/css-in-js/basics/AdaptingHOC.js"}}
{{"demo": "pages/css-in-js/basics/AdaptingHOC.js", "react": "next"}}

### Adapting render props API

{{"demo": "pages/css-in-js/basics/AdaptingRenderProps.js"}}
{{"demo": "pages/css-in-js/basics/AdaptingRenderProps.js", "react": "next"}}

0 comments on commit 9aec376

Please sign in to comment.