diff --git a/internals/generators/class/index.js b/internals/generators/class/index.js
index 69b107e3..80b2ca0c 100644
--- a/internals/generators/class/index.js
+++ b/internals/generators/class/index.js
@@ -34,6 +34,12 @@ module.exports = {
default: true,
message: 'Do you want styles?',
},
+ {
+ type: 'confirm',
+ name: 'wantTheme',
+ default: false,
+ message: 'Do you want to wrap your component with ThemeProvider?',
+ },
{
type: 'confirm',
name: 'wantLoadable',
diff --git a/internals/generators/class/index.js.hbs b/internals/generators/class/index.js.hbs
index 3b4d22b2..056a3301 100644
--- a/internals/generators/class/index.js.hbs
+++ b/internals/generators/class/index.js.hbs
@@ -7,7 +7,6 @@
import React from 'react';
{{#if wantStyles}}
import PropTypes from 'prop-types';
-import theme from 'utils/theme';
{{else}}
// import PropTypes from 'prop-types';
{{/if}}
@@ -15,17 +14,27 @@ import theme from 'utils/theme';
import { Helmet } from 'react-helmet';
{{/if}}
{{#if wantStyles}}
-import { withStyles, ThemeProvider } from '@material-ui/core/styles';
-import styles from './styles';
+import { withStyles, {{#if wantTheme }}ThemeProvider{{/if}} } from '@material-ui/core/styles';
{{else}}
+{{#if wantTheme}}
import { ThemeProvider } from '@material-ui/core/styles';
{{/if}}
+{{/if}}
+{{#if wantTheme}}
+import theme from 'utils/theme';
+{{/if}}
+
+{{#if wantStyles}}
+import styles from './styles';
+{{/if}}
class {{ properCase name }} extends React.Component {
render() {
{{#if wantStyles}}const { classes } = this.props;{{/if}}
return (
+{{#if wantTheme}}
+{{/if}}
{{#if wantHeaders}}
@@ -34,7 +43,9 @@ return (
{{/if}}
+{{#if wantTheme}}
+{{/if}}
);
}
}
diff --git a/internals/generators/functional/index.js b/internals/generators/functional/index.js
index f8a62e03..f06ed321 100644
--- a/internals/generators/functional/index.js
+++ b/internals/generators/functional/index.js
@@ -26,6 +26,12 @@ module.exports = {
return 'The name is required';
},
},
+ {
+ type: 'confirm',
+ name: 'wantHeaders',
+ default: false,
+ message: 'Do you want headers?',
+ },
{
type: 'confirm',
name: 'memo',
@@ -38,6 +44,12 @@ module.exports = {
default: true,
message: 'Do you want styles?',
},
+ {
+ type: 'confirm',
+ name: 'wantTheme',
+ default: false,
+ message: 'Do you want to wrap your component with ThemeProvider?',
+ },
{
type: 'confirm',
name: 'wantLoadable',
diff --git a/internals/generators/functional/index.js.hbs b/internals/generators/functional/index.js.hbs
index 3d31a638..c168cc77 100644
--- a/internals/generators/functional/index.js.hbs
+++ b/internals/generators/functional/index.js.hbs
@@ -14,8 +14,18 @@ import PropTypes from 'prop-types';
{{else}}
// import PropTypes from 'prop-types';
{{/if}}
+{{#if wantHeaders}}
+import { Helmet } from 'react-helmet';
+{{/if}}
{{#if wantStyles}}
-import { withStyles } from '@material-ui/core/styles';
+import { withStyles, {{#if wantTheme }}ThemeProvider{{/if}} } from '@material-ui/core/styles';
+{{else}}
+{{#if wantTheme}}
+import { ThemeProvider } from '@material-ui/core/styles';
+{{/if}}
+{{/if}}
+{{#if wantTheme}}
+import theme from 'utils/theme';
{{/if}}
{{#if wantStyles}}
@@ -24,8 +34,20 @@ import styles from './styles';
function {{ properCase name }}({{#if wantStyles}}{ classes }{{/if}}) {
return (
-
+{{#if wantTheme}}
+
+{{/if}}
+
+ {{#if wantHeaders}}
+
+ {{properCase name}}
+
+
+ {{/if}}
+{{#if wantTheme}}
+
+{{/if}}
);
}