-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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 Base installation page #30969
Changes from 12 commits
b2a4378
6a11625
cc20bb8
21e63fb
38b11bd
f826462
1cd3568
d9faebd
d878a32
87ec394
50ec175
6ef5c9a
72937bb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Installation | ||
|
||
<p class="description">Install MUI Base, the unstyled components & foundation hooks for building accessible UIs</p> | ||
|
||
## npm | ||
|
||
To install and save in your `package.json` dependencies, run: | ||
|
||
```sh | ||
// with npm | ||
npm install @mui/base | ||
|
||
// with yarn | ||
yarn add @mui/base | ||
``` | ||
|
||
<!-- #react-peer-version --> | ||
|
||
Please note that [react](https://www.npmjs.com/package/react) >= 17.0.0 and [react-dom](https://www.npmjs.com/package/react-dom) >= 17.0.0 are peer dependencies. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import * as React from 'react'; | ||
import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs'; | ||
import { | ||
demos, | ||
docs, | ||
demoComponents, | ||
} from 'docs/data/base/getting-started/installation/installation.md?@mui/markdown'; | ||
|
||
export default function Page() { | ||
return <MarkdownDocs demos={demos} docs={docs} demoComponents={demoComponents} />; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -115,7 +115,7 @@ function ProductDrawerButton(props) { | |
}; | ||
|
||
return ( | ||
<div> | ||
<React.Fragment> | ||
<Button | ||
id="mui-product-selector" | ||
aria-controls="drawer-open-button" | ||
|
@@ -128,7 +128,6 @@ function ProductDrawerButton(props) { | |
minWidth: 0, | ||
fontSize: theme.typography.pxToRem(13), | ||
fontWeight: 500, | ||
lineHeight: 0, | ||
color: | ||
theme.palette.mode === 'dark' ? theme.palette.primary[300] : theme.palette.primary[600], | ||
'& svg': { | ||
|
@@ -188,14 +187,12 @@ function ProductDrawerButton(props) { | |
description="Ready-to-use foundational components, free forever." | ||
/> | ||
<LinksWrapper> | ||
{FEATURE_TOGGLE.enable_mui_base_scope && ( | ||
<Link | ||
href={ROUTES.baseDocs} | ||
// eslint-disable-next-line material-ui/no-hardcoded-labels | ||
> | ||
Base <KeyboardArrowRight fontSize="small" /> | ||
</Link> | ||
)} | ||
<Link | ||
href={ROUTES.baseDocs} | ||
// eslint-disable-next-line material-ui/no-hardcoded-labels | ||
> | ||
MUI Base <KeyboardArrowRight fontSize="small" /> | ||
</Link> | ||
<Link | ||
href={ROUTES.materialDocs} | ||
// eslint-disable-next-line material-ui/no-hardcoded-labels | ||
|
@@ -236,7 +233,7 @@ function ProductDrawerButton(props) { | |
</LinksWrapper> | ||
</li> | ||
</Menu> | ||
</div> | ||
</React.Fragment> | ||
); | ||
} | ||
|
||
|
@@ -245,38 +242,23 @@ ProductDrawerButton.propTypes = { | |
}; | ||
|
||
const ProductIdentifier = ({ name, metadata, versionSelector }) => ( | ||
<Box | ||
sx={{ | ||
width: '100%', | ||
display: 'flex', | ||
flex: 'auto', | ||
alignItems: 'center', | ||
justifyContent: 'space-between', | ||
}} | ||
> | ||
<div> | ||
<Typography | ||
sx={(theme) => ({ | ||
ml: 1, | ||
color: theme.palette.grey[600], | ||
fontSize: theme.typography.pxToRem(11), | ||
fontWeight: 700, | ||
textTransform: 'uppercase', | ||
letterSpacing: '.08rem', | ||
})} | ||
> | ||
{metadata} | ||
</Typography> | ||
<Box | ||
sx={{ | ||
display: 'flex', | ||
alignItems: 'end', | ||
}} | ||
> | ||
<ProductDrawerButton productName={name} /> | ||
{versionSelector} | ||
</Box> | ||
</div> | ||
<Box sx={{ flexGrow: 1 }}> | ||
<Typography | ||
sx={(theme) => ({ | ||
ml: 1, | ||
color: theme.palette.grey[600], | ||
fontSize: theme.typography.pxToRem(11), | ||
fontWeight: 700, | ||
textTransform: 'uppercase', | ||
letterSpacing: '.08rem', | ||
})} | ||
> | ||
{metadata} | ||
</Typography> | ||
<Box sx={{ display: 'flex' }}> | ||
<ProductDrawerButton productName={name} /> | ||
{versionSelector} | ||
</Box> | ||
</Box> | ||
); | ||
|
||
|
@@ -345,7 +327,8 @@ const ToolbarIE11 = styled('div')({ display: 'flex' }); | |
const ToolbarDiv = styled('div')(({ theme }) => { | ||
return { | ||
padding: theme.spacing(1.45, 2), | ||
height: 64, | ||
paddingRight: 0, | ||
height: 'var(--MuiDocs-header-height)', | ||
display: 'flex', | ||
flexGrow: 1, | ||
flexDirection: 'row', | ||
|
@@ -367,7 +350,7 @@ const StyledDrawer = styled(Drawer)(({ theme }) => { | |
|
||
const SwipeableDrawerPaperComponent = styled('div')(({ theme }) => { | ||
return { | ||
width: 280, | ||
width: 'var(--MuiDocs-navDrawer-width)', | ||
boxShadow: 'none', | ||
[theme.breakpoints.up('xs')]: { | ||
borderRadius: '0px 10px 10px 0px', | ||
|
@@ -403,7 +386,7 @@ function reduceChildRoutes(context) { | |
return items; | ||
} | ||
|
||
if (page.children && page.children.length > 1) { | ||
if (page.children && page.children.length >= 1) { | ||
const title = pageToTitleI18n(page, t); | ||
const topLevel = activePage | ||
? activePage.pathname.indexOf(`${page.pathname}`) === 0 || | ||
|
@@ -469,7 +452,7 @@ function AppNavDrawer(props) { | |
|
||
const navItems = renderNavItems({ onClose, pages, activePage, depth: 0, t }); | ||
|
||
const renderVersionSelector = (versions = []) => { | ||
const renderVersionSelector = (versions = [], sx) => { | ||
if (!versions?.length) { | ||
return null; | ||
} | ||
|
@@ -480,42 +463,48 @@ function AppNavDrawer(props) { | |
onClick={(event) => { | ||
setAnchorEl(event.currentTarget); | ||
}} | ||
endIcon={<ArrowDropDownRoundedIcon fontSize="small" sx={{ ml: -0.5 }} />} | ||
sx={(theme) => ({ | ||
py: 0.1, | ||
minWidth: 0, | ||
fontSize: theme.typography.pxToRem(13), | ||
fontWeight: 500, | ||
lineHeight: 0, | ||
color: | ||
theme.palette.mode === 'dark' | ||
? theme.palette.primary[300] | ||
: theme.palette.primary[600], | ||
'& svg': { | ||
ml: -0.6, | ||
width: 18, | ||
height: 18, | ||
}, | ||
...(!isProductScoped && { | ||
px: 1, | ||
py: 0.4, | ||
border: `1px solid ${ | ||
endIcon={ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Off-topic. I have noticed this behavior for Windows users, I'm not sure how to solve this layout constraint issue: layout.shift.mp4There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can stretch the space a little bit more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
versions.length > 1 ? ( | ||
<ArrowDropDownRoundedIcon fontSize="small" sx={{ ml: -0.5 }} /> | ||
) : null | ||
} | ||
sx={[ | ||
(theme) => ({ | ||
py: 0.1, | ||
minWidth: 0, | ||
fontSize: theme.typography.pxToRem(13), | ||
fontWeight: 500, | ||
color: | ||
theme.palette.mode === 'dark' | ||
? theme.palette.primaryDark[700] | ||
: theme.palette.grey[200] | ||
}`, | ||
'&:hover': { | ||
borderColor: | ||
theme.palette.mode === 'dark' | ||
? theme.palette.primaryDark[600] | ||
: theme.palette.grey[300], | ||
background: | ||
theme.palette.mode === 'dark' | ||
? alpha(theme.palette.primaryDark[700], 0.4) | ||
: theme.palette.grey[50], | ||
? theme.palette.primary[300] | ||
: theme.palette.primary[600], | ||
'& svg': { | ||
ml: -0.6, | ||
width: 18, | ||
height: 18, | ||
}, | ||
...(!isProductScoped && { | ||
px: 1, | ||
py: 0.4, | ||
border: `1px solid ${ | ||
theme.palette.mode === 'dark' | ||
? theme.palette.primaryDark[700] | ||
: theme.palette.grey[200] | ||
}`, | ||
'&:hover': { | ||
borderColor: | ||
theme.palette.mode === 'dark' | ||
? theme.palette.primaryDark[600] | ||
: theme.palette.grey[300], | ||
background: | ||
theme.palette.mode === 'dark' | ||
? alpha(theme.palette.primaryDark[700], 0.4) | ||
: theme.palette.grey[50], | ||
}, | ||
}), | ||
}), | ||
})} | ||
...(Array.isArray(sx) ? sx : [sx]), | ||
]} | ||
> | ||
{versions[0].text} | ||
</Button> | ||
|
@@ -581,10 +570,13 @@ function AppNavDrawer(props) { | |
</Box> | ||
</NextLink> | ||
{!isProductScoped && | ||
renderVersionSelector([ | ||
{ text: `v${process.env.LIB_VERSION}`, current: true }, | ||
{ text: 'v4', href: `https://v4.mui.com${languagePrefix}/` }, | ||
])} | ||
renderVersionSelector( | ||
[ | ||
{ text: `v${process.env.LIB_VERSION}`, current: true }, | ||
{ text: 'v4', href: `https://v4.mui.com${languagePrefix}/` }, | ||
], | ||
{ mr: 1 }, | ||
siriwatknp marked this conversation as resolved.
Show resolved
Hide resolved
|
||
)} | ||
{router.asPath.startsWith('/material/') && ( | ||
<ProductIdentifier | ||
name="Material UI" | ||
|
@@ -610,7 +602,7 @@ function AppNavDrawer(props) { | |
)} | ||
{router.asPath.startsWith('/base/') && ( | ||
<ProductIdentifier | ||
name="Base" | ||
name="MUI Base" | ||
metadata="MUI Core" | ||
versionSelector={renderVersionSelector([ | ||
{ text: `v${basePkgJson.version}`, current: true }, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Depends on #30960
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that 1. is an option as it's not self-sustained: need to be able to search it on Google and find what you are looking for.
For 2 vs. 3. No preferences, both could fly.
Maybe the only note I would have is either
/base
in the URL is enough or either it should match the name. I think that depending on the option, here is what a great URL would look like:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With "MUI Core" and "MUI X" above and below, I think "MUI Base" would match better with consistency.
p.s. I think renaming System to "MUI System" and "Data Grid" to "MUI Data Grid" would make the names look more in order as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with @oliviertassinari - option 1 isn't the best. I don't have a strong preference. Also, since we decided not to follow the "MUI *" pattern for all the products, it opens up the possibility to rename Base to something more distinct.
Let's keep MUI Base for now so we don't keep the PR open for too long. It's easy to change it later on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm with Michal, to not use too much time here to discuss the name and instead maybe focus on the installation walkthrough itself. We can better resolve naming by looking at everything at once holistically later.