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 d30dd06
Show file tree
Hide file tree
Showing 3 changed files with 21 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
24 changes: 16 additions & 8 deletions docs/src/modules/utils/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,17 @@ function addTypeDeps(deps) {

deps[`@types/${resolvedName}`] = 'latest';
});
}

return deps;
function includePeerDependencies(deps, versions) {
Object.assign(deps, {
'react-dom': versions['react-dom'],
react: versions.react,
});

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

/**
Expand All @@ -84,11 +93,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 +108,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 @@ -118,15 +128,13 @@ function getDependencies(raw, options = {}) {
}
}

includePeerDependencies(deps, versions);

if (codeLanguage === CODE_VARIANTS.TS) {
addTypeDeps(deps);
deps.typescript = 'latest';
}

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

return deps;
}

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 d30dd06

Please sign in to comment.