Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

349
Views
Ant Design Sidebar Layout Example Not working as expected

I have a React webapp with Ant design component framework version 4.

I tried to use this example from Antd docs in my webapp: https://codesandbox.io/s/ymspt

But I don't get the same result when I use the code in my webapp. This is how it looks like in my app

import { MenuFoldOutlined, MenuUnfoldOutlined, UploadOutlined, UserOutlined, VideoCameraAddOutlined } from "@ant-design/icons";
import { Layout, Menu, Space } from "antd";
import { Content, Footer, Header } from "antd/lib/layout/layout";
import Sider from "antd/lib/layout/Sider";
import React, { useState } from "react";
import { logOut } from "../firebase";


function Lineups() {
    const [collapsed, setCollapsed] = useState(false);
    const [logoText, setLogoText] = useState("TEAMTAC");

    const toggle = () => {
        setCollapsed(!collapsed);
        collapsed ? setLogoText("TEAMTAC") : setLogoText("TT")
    };

    const signOutFirebase = async () => {
        await logOut();
    }

    return (
        <Layout style={{ minHeight: '100vh' }}>
            <Sider collapsible collapsed={collapsed} onCollapse={toggle}>
               <h2 style={{textAlign:"center", marginTop: 15}}>{logoText}</h2>
                <Menu theme="dark" mode="inline" defaultSelectedKeys={['1']}>
                    <Menu.Item key="1" icon={<UserOutlined />}>
                        nav 1
                    </Menu.Item>
                    <Menu.Item key="2" icon={<VideoCameraAddOutlined />}>
                        nav 2
                    </Menu.Item>
                    <Menu.Item key="3" icon={<UploadOutlined />}>
                        nav 3
                    </Menu.Item>
                </Menu>
            </Sider>
            <Layout className="site-layout">
                <Header  style={{ padding: 5 }}>
                 Header
                </Header>
                <Content
                    style={{
                        margin: '24px 16px',
                        padding: 24,
                        minHeight: 280,
                    }}
                >
                    Content
                </Content>
                <Footer style={{ textAlign: 'center' }}>Ant Design ©2018 Created by Ant UED</Footer>

            </Layout>
        </Layout>
    )
}

export default Lineups;

I dont have any extra css or whatever.

How come that I don't get the same result?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Problem were the components which Ive imported. I did it the wrong way.

So instead of

import { Content, Footer, Header } from "antd/lib/layout/layout";

I had to do

import { Layout } from "antd"; 
...
const { Header, Footer, Sider, Content } = Layout;
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!