Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] Add company page #18964

Merged
merged 7 commits into from
Jan 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crowdin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ files:
- /docs/src/pages/getting-started/templates/*/**/*
- /docs/src/pages/premium-themes/*/**/*
- /docs/src/pages/discover-more/backers/*
- /docs/src/pages/discover-more/governance/*
- /docs/src/pages/discover-more/roadmap/*
- /docs/src/pages/company/*
translation: /%original_path%/%file_name%-%two_letters_code%.%file_extension%
- source: /docs/translations/*.json
ignore:
Expand Down
14 changes: 14 additions & 0 deletions docs/pages/company/about.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from 'react';
import TopLayoutCompany from 'docs/src/modules/components/TopLayoutCompany';

const req = require.context('docs/src/pages/company/about', false, /\.(md|js|tsx)$/);
const reqSource = require.context(
'!raw-loader!../../src/pages/company/about',
false,
/\.(js|tsx)$/,
);
const reqPrefix = 'pages/company/about';

export default function Page() {
return <TopLayoutCompany req={req} reqSource={reqSource} reqPrefix={reqPrefix} />;
}
14 changes: 14 additions & 0 deletions docs/pages/company/contact.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from 'react';
import TopLayoutCompany from 'docs/src/modules/components/TopLayoutCompany';

const req = require.context('docs/src/pages/company/contact', false, /\.(md|js|tsx)$/);
const reqSource = require.context(
'!raw-loader!../../src/pages/company/contact',
false,
/\.(js|tsx)$/,
);
const reqPrefix = 'pages/company/contact';

export default function Page() {
return <TopLayoutCompany req={req} reqSource={reqSource} reqPrefix={reqPrefix} />;
}
14 changes: 0 additions & 14 deletions docs/pages/discover-more/governance.js

This file was deleted.

8 changes: 4 additions & 4 deletions docs/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ function loadDependencies() {
const useStyles = makeStyles(theme => ({
root: {
flex: '1 0 100%',
},
drawer: {
width: 0,
'& #main-content': {
outline: 0,
},
},
hero: {
paddingTop: 64,
Expand Down Expand Up @@ -111,7 +111,7 @@ export default function HomePage() {
const classes = useStyles();

return (
<AppFrame classes={{ drawer: classes.drawer }}>
<AppFrame>
<div className={classes.root}>
<Head />
<main id="main-content" tabIndex="-1">
Expand Down
16 changes: 11 additions & 5 deletions docs/src/modules/components/AppContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const useStyles = makeStyles(theme => ({
position: 'relative',
maxWidth: '100%',
margin: '0 auto',
outline: 0,
[theme.breakpoints.up('sm')]: {
paddingRight: theme.spacing(1),
maxWidth: 'calc(100% - 175px)',
Expand Down Expand Up @@ -40,18 +41,22 @@ const useStyles = makeStyles(theme => ({
}));

export default function AppContent(props) {
const { children, disableAd, disableToc } = props;
const { children, className, disableAd, disableToc } = props;
const classes = useStyles();

return (
<Container
component="main"
id="main-content"
tabIndex={-1}
className={clsx(classes.root, {
[classes.ad]: !disableAd,
[classes.disableToc]: disableToc,
})}
className={clsx(
classes.root,
{
[classes.ad]: !disableAd,
[classes.disableToc]: disableToc,
},
className,
)}
>
{children}
</Container>
Expand All @@ -60,6 +65,7 @@ export default function AppContent(props) {

AppContent.propTypes = {
children: PropTypes.node.isRequired,
className: PropTypes.string,
disableAd: PropTypes.bool.isRequired,
disableToc: PropTypes.bool.isRequired,
};
13 changes: 4 additions & 9 deletions docs/src/modules/components/AppFrame.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ import Link from 'docs/src/modules/components/Link';
import AppDrawer from 'docs/src/modules/components/AppDrawer';
import Notifications from 'docs/src/modules/components/Notifications';
import MarkdownLinks from 'docs/src/modules/components/MarkdownLinks';
import usePageTitle from 'docs/src/modules/components/usePageTitle';
import { LANGUAGES_LABEL } from 'docs/src/modules/constants';
import { pathnameToLanguage } from 'docs/src/modules/utils/helpers';
import { useChangeTheme } from 'docs/src/modules/components/ThemeContext';
import PageContext from 'docs/src/modules/components/PageContext';

const LOCALES = { zh: 'zh-CN', pt: 'pt-BR', es: 'es-ES' };
const CROWDIN_ROOT_URL = 'https://translate.material-ui.com/project/material-ui-docs/';
Expand Down Expand Up @@ -137,11 +137,6 @@ const styles = theme => ({
display: 'none',
},
},
'@global': {
'#main-content': {
outline: 0,
},
},
});

function AppFrame(props) {
Expand Down Expand Up @@ -183,13 +178,13 @@ function AppFrame(props) {

const router = useRouter();
const { canonical } = pathnameToLanguage(Router2._rewriteUrlForNextExport(router.asPath));
const title = usePageTitle({ t });
const { activePage } = React.useContext(PageContext);

let disablePermanent = false;
let navIconClassName = '';
let appBarClassName = classes.appBar;

if (title === null) {
if (activePage.title === false) {
// home route, don't shift app bar or dock drawer
disablePermanent = true;
appBarClassName += ` ${classes.appBarHome}`;
Expand Down Expand Up @@ -337,7 +332,7 @@ function AppFrame(props) {
</Toolbar>
</AppBar>
<AppDrawer
className={classes.drawer}
className={disablePermanent ? '' : classes.drawer}
disablePermanent={disablePermanent}
onClose={handleDrawerClose}
onOpen={handleDrawerOpen}
Expand Down
3 changes: 1 addition & 2 deletions docs/src/modules/components/EditPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import { useSelector } from 'react-redux';
import Button from '@material-ui/core/Button';

const SOURCE_CODE_ROOT_URL = 'https://github.com/mui-org/material-ui/edit/master';
import { SOURCE_CODE_ROOT_URL } from 'docs/src/modules/constants';

export default function EditPage(props) {
const { markdownLocation } = props;
Expand Down
8 changes: 4 additions & 4 deletions docs/src/modules/components/Head.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React from 'react';
import NextHead from 'next/head';
import { Router as Router2, useRouter } from 'next/router';
import { Router, useRouter } from 'next/router';
import PropTypes from 'prop-types';
import { useSelector } from 'react-redux';

export default function Head(props) {
const router = useRouter();
const t = useSelector(state => state.options.t);
const userLanguage = useSelector(state => state.options.userLanguage);
const { description = t('strapline'), title = t('headTitle'), children } = props;
const userLanguage = useSelector(state => state.options.userLanguage);
const router = useRouter();

return (
<NextHead>
Expand All @@ -30,7 +30,7 @@ export default function Head(props) {
<meta property="og:title" content={title} />
<meta
property="og:url"
content={`https://material-ui.com${Router2._rewriteUrlForNextExport(router.asPath)}`}
content={`https://material-ui.com${Router._rewriteUrlForNextExport(router.asPath)}`}
/>
<meta property="og:description" content={description} />
<meta property="og:image" content="https://material-ui.com/static/brand.png" />
Expand Down
30 changes: 25 additions & 5 deletions docs/src/modules/components/HomeFooter.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable material-ui/no-hardcoded-labels */
import React from 'react';
import PropTypes from 'prop-types';
import { useSelector } from 'react-redux';
Expand All @@ -22,7 +23,7 @@ const styles = theme => ({
marginBottom: theme.spacing(4),
'& img': {
width: 28,
height: 28,
height: 22,
marginRight: theme.spacing(1.5),
},
},
Expand Down Expand Up @@ -56,13 +57,15 @@ function HomeFooter(props) {
<Container maxWidth="md">
<footer className={classes.footer}>
<Grid container>
<Grid item xs={12} sm={4}>
<Grid item xs={12} sm={3}>
<div className={classes.logo}>
<img src="/static/images/material-ui-logo.svg" alt="" />
<Typography color="primary">Material-UI</Typography>
<Link variant="body1" color="inherit" href="/">
Material-UI
</Link>
</div>
</Grid>
<Grid item xs={6} sm={4} className={classes.list}>
<Grid item xs={6} sm={3} className={classes.list}>
<Typography component="h2" gutterBottom>
{t('footerCommunity')}
</Typography>
Expand Down Expand Up @@ -97,7 +100,7 @@ function HomeFooter(props) {
</li>
</ul>
</Grid>
<Grid item xs={6} sm={4} className={classes.list}>
<Grid item xs={6} sm={3} className={classes.list}>
<Typography component="h2" gutterBottom>
{t('footerResources')}
</Typography>
Expand All @@ -119,6 +122,23 @@ function HomeFooter(props) {
</li>
</ul>
</Grid>
<Grid item xs={6} sm={3} className={classes.list}>
<Typography component="h2" gutterBottom>
{t('footerCompany')}
</Typography>
<ul>
<li>
<Link color="inherit" variant="body2" href="/company/about/">
About
</Link>
</li>
<li>
<Link color="inherit" variant="body2" href="/company/contact/">
Contact Us
</Link>
</li>
</ul>
</Grid>
</Grid>
<Typography className={classes.version} color="textSecondary" variant="body2">
<Interpolate
Expand Down
Loading