Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I create a custom page with #react-admin without the menu sidebar like login page?

I am using react-admin previously admin-on-rest. I want to create a custom page that doesn't show the Menu sidebar, like Login page. I will use this page reset user's password. How can I do that?

like image 673
thecassion Avatar asked Jul 10 '18 14:07

thecassion


People also ask

How do I create a custom page in WordPress theme?

Go to WordPress Admin Panel > Pages > Add New. You can see the new custom page template listed on the right side. Create a new page and set its template to PageWithoutSidebar. Once done, Publish it.

What is a custom page?

A custom page lets you use a different layout from your regular pages in WordPress. Many WordPress sites have custom page layouts for their sales pages, landing pages, webinar pages, and more.


3 Answers

This is not obvious in the documentation but the Route actually accepts a noLayout prop:

<Admin
    customRoutes={[
        <Route
            path="/custom"
            component={CustomRouteNoLayout}
            noLayout
        />,
        <Route
            path="/custom2"
            component={CustomRouteWithLayout}
        />,
    ]}
>
like image 70
Gildas Garcia Avatar answered Oct 19 '22 20:10

Gildas Garcia


I'd like to add on to Gildas Garcia's answer. After you added the customed routes as shown in the documentation, you need to add a hash # in front of the route url to be able to view the content. For example, if you are displaying the view at localhost:3000/, and one of your routes is

<Route exact path="/foo" component={Foo} />,

then you should go to localhost:3000/#/foo to view the content.

like image 38
Darius Avatar answered Oct 19 '22 19:10

Darius


Add a custom route with the component you want to render. When route is successful the specified component will be presented. No Menu will be shown just whatever you have in the component you send as prop to Route.

The way you put the question it seemed like you were trying to have a custom page that hadn't a MenuItemLink in Menu. Had to reread the question to understand what you wanted.

like image 45
Mário Ferreiro Avatar answered Oct 19 '22 19:10

Mário Ferreiro



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!