Skip to content

Commit

Permalink
Sebastian feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Nov 8, 2019
1 parent d7ff215 commit 631f82f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 10 deletions.
6 changes: 4 additions & 2 deletions docs/src/modules/components/DiamondSponsors.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable material-ui/no-hardcoded-labels */
import React from 'react';
import Typography from '@material-ui/core/Typography';
import Box from '@material-ui/core/Box';
import { useSelector } from 'react-redux';
import { makeStyles } from '@material-ui/core/styles';
import AddIcon from '@material-ui/icons/Add';

Expand Down Expand Up @@ -36,10 +36,12 @@ const useStyles = makeStyles(theme => ({

export default function DiamondSponsors() {
const classes = useStyles();
const t = useSelector(state => state.options.t);

return (
<Box mx={3} my={2} className={classes.root}>
<Typography variant="caption" color="textSecondary" display="block">
Diamond Sponsors
{t('diamondSponsors')}
</Typography>
<a
className={classes.placeholder}
Expand Down
27 changes: 19 additions & 8 deletions docs/src/modules/utils/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,20 @@ function addTypeDeps(deps) {
return deps;
}

function includePeerDependencies(deps, versions) {
const output = {
'react-dom': versions['react-dom'],
react: versions.react,
...deps,
};

if (output['@material-ui/lab'] && !output['@material-ui/core']) {
output['@material-ui/core'] = versions['@material-ui/core'];
}

return output;
}

/**
* @param {string} raw - ES6 source with es module imports
* @param {objects} options
Expand All @@ -84,11 +98,11 @@ function addTypeDeps(deps) {
*/
function getDependencies(raw, options = {}) {
const { codeLanguage = CODE_VARIANTS.JS, reactVersion = 'latest' } = options;
const deps = {

const deps = {};
const versions = {
'react-dom': reactVersion,
react: reactVersion,
};
const versions = {
'@material-ui/core': 'latest',
'@material-ui/icons': 'latest',
'@material-ui/lab': 'latest',
Expand All @@ -99,6 +113,7 @@ function getDependencies(raw, options = {}) {
jss: 'next',
'jss-plugin-template': 'next',
};

const re = /^import\s'([^']+)'|import\s[\s\S]*?\sfrom\s+'([^']+)/gm;
let m;
// eslint-disable-next-line no-cond-assign
Expand All @@ -123,11 +138,7 @@ function getDependencies(raw, options = {}) {
deps.typescript = 'latest';
}

if (deps['@material-ui/lab'] && !deps['@material-ui/core']) {
deps['@material-ui/core'] = 'latest';
}

return deps;
return includePeerDependencies(deps, versions);
}

function getCookie(name) {
Expand Down
1 change: 1 addition & 0 deletions docs/translations/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
"increaseSpacing": "increase spacing",
"decreaseSpacing": "decrease spacing",
"getProfessionalSupport": "Get Professional Support",
"diamondSponsors": "Diamond Sponsors",
"pages": {
"/getting-started": "Getting Started",
"/getting-started/installation": "Installation",
Expand Down

0 comments on commit 631f82f

Please sign in to comment.