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 BackdropUnstyled docs #31855

Closed
wants to merge 1 commit into from
Closed
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
32 changes: 32 additions & 0 deletions docs/data/base/components/backdrop/SimpleBackdrop.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import * as React from 'react';
import BackdropUnstyled from '@mui/base/BackdropUnstyled';
import { styled } from '@mui/system';

const Backdrop = styled(BackdropUnstyled)`
position: fixed;
right: 0;
bottom: 0;
top: 0;
left: 0;
background-color: rgba(0, 0, 0, 0.5);
z-index: 1201;
`;

export default function SimpleBackdrop() {
const [open, setOpen] = React.useState(false);
const handleClose = () => {
setOpen(false);
};
const handleOpen = () => {
setOpen(true);
};

return (
<div>
<button type="button" onClick={handleOpen}>
Show backdrop
</button>
{open && <Backdrop onClick={handleClose} />}
</div>
);
}
32 changes: 32 additions & 0 deletions docs/data/base/components/backdrop/SimpleBackdrop.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import * as React from 'react';
import BackdropUnstyled from '@mui/base/BackdropUnstyled';
import { styled } from '@mui/system';

const Backdrop = styled(BackdropUnstyled)`
position: fixed;
right: 0;
bottom: 0;
top: 0;
left: 0;
background-color: rgba(0, 0, 0, 0.5);
z-index: 1201;
`;

export default function SimpleBackdrop() {
const [open, setOpen] = React.useState(false);
const handleClose = () => {
setOpen(false);
};
const handleOpen = () => {
setOpen(true);
};

return (
<div>
<button type="button" onClick={handleOpen}>
Show backdrop
</button>
{open && <Backdrop onClick={handleClose} />}
</div>
);
}
4 changes: 4 additions & 0 deletions docs/data/base/components/backdrop/SimpleBackdrop.tsx.preview
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<button type="button" onClick={handleOpen}>
Show backdrop
</button>
{open && <Backdrop onClick={handleClose} />}
24 changes: 24 additions & 0 deletions docs/data/base/components/backdrop/backdrop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
product: base
title: Unstyled React backdrop
components: BackdropUnstyled
githubLabel: 'component: backdrop'
packageName: '@mui/base'
---

# Unstyled backdrop

<p class="description">The backdrop component is used to provide emphasis on a particular element or parts of it.</p>

```js
import BackdropUnstyled from '@mui/base/BackdropUnstyled';
```

The backdrop signals to the user of a state change within the application and can be used for creating loaders, dialogs, and more.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The backdrop signals to the user of a state change within the application and can be used for creating loaders, dialogs, and more.
The backdrop signals to the user of a state change within the application and hence can be used for creating loaders, dialogs, and more.

In its simplest form, the backdrop component will add a dimmed layer over your application.

{{"component": "modules/components/ComponentLinkHeader.js", "design": false}}

## Example

{{"demo": "SimpleBackdrop.js", "defaultCodeOpen": false}}
5 changes: 5 additions & 0 deletions docs/data/base/pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ const pages = [
subheader: 'inputs',
children: [{ pathname: '/base/react-button', title: 'Button' }],
},
{
pathname: '/base/components/feedback',
subheader: 'feedback',
children: [{ pathname: '/base/react-backdrop', title: 'Backdrop' }],
},
{
pathname: '/base/components/navigation',
subheader: 'navigation',
Expand Down
12 changes: 2 additions & 10 deletions docs/data/material/components/backdrop/backdrop.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
---
product: material-ui
title: Backdrop React Component
components: Backdrop, BackdropUnstyled
components: Backdrop
githubLabel: 'component: backdrop'
unstyled: /base/react-backdrop
---

# Backdrop
Expand All @@ -17,12 +18,3 @@ In its simplest form, the backdrop component will add a dimmed layer over your a
## Example

{{"demo": "SimpleBackdrop.js"}}

## Unstyled

The backdrop also comes with the Base package.
It's ideal for doing heavy customizations and minimizing bundle size.

```js
import BackdropUnstyled from '@mui/base/BackdropUnstyled';
```
23 changes: 0 additions & 23 deletions docs/pages/api-docs/backdrop-unstyled.js

This file was deleted.

28 changes: 0 additions & 28 deletions docs/pages/api-docs/backdrop-unstyled.json

This file was deleted.

2 changes: 1 addition & 1 deletion docs/pages/base/api/backdrop-unstyled.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@
"forwardsRefTo": "HTMLDivElement",
"filename": "/packages/mui-base/src/BackdropUnstyled/BackdropUnstyled.js",
"inheritance": null,
"demos": "<ul><li><a href=\"/material-ui/react-backdrop/\">Backdrop</a></li></ul>",
"demos": "<ul><li><a href=\"/base/react-backdrop/\">Backdrop</a></li>\n<li><a href=\"/material/react-backdrop/\">Backdrop</a></li></ul>",
"cssComponent": false
}
11 changes: 11 additions & 0 deletions docs/pages/base/react-backdrop.js
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/components/backdrop/backdrop.md?@mui/markdown';

export default function Page() {
return <MarkdownDocs demos={demos} docs={docs} demoComponents={demoComponents} />;
}
7 changes: 6 additions & 1 deletion docs/scripts/buildApiUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,12 @@ export type ComponentInfo = {
skipApiGeneration?: boolean;
};

const migratedBaseComponents = ['ButtonUnstyled', 'MenuUnstyled', 'MenuItemUnstyled'];
const migratedBaseComponents = [
'BackdropUnstyled',
'ButtonUnstyled',
'MenuUnstyled',
'MenuItemUnstyled',
];

export const getGenericComponentInfo = (filename: string): ComponentInfo => {
const { name } = extractPackageFile(filename);
Expand Down
1 change: 0 additions & 1 deletion docs/src/pagesApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ module.exports = [
{ pathname: '/api-docs/avatar' },
{ pathname: '/api-docs/avatar-group' },
{ pathname: '/api-docs/backdrop' },
{ pathname: '/api-docs/backdrop-unstyled' },
{ pathname: '/api-docs/badge' },
{ pathname: '/api-docs/badge-unstyled' },
{ pathname: '/api-docs/bottom-navigation' },
Expand Down
5 changes: 3 additions & 2 deletions packages/mui-base/src/BackdropUnstyled/BackdropUnstyled.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,12 @@ export type ExtendBackdropUnstyled<M extends OverridableTypeMap> = OverridableCo
*
* Demos:
*
* - [Backdrop](https://mui.com/components/backdrop/)
* - [Backdrop](https://mui.com/base/react-backdrop/)
* - [Backdrop](https://mui.com/material/react-backdrop/)
*
* API:
*
* - [BackdropUnstyled API](https://mui.com/api/backdrop-unstyled/)
* - [BackdropUnstyled API](https://mui.com/base/api/backdrop-unstyled/)
*/
declare const BackdropUnstyled: OverridableComponent<BackdropUnstyledTypeMap>;

Expand Down