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

341
Views
El ejemplo de diseño de la barra lateral de Ant Design no funciona como se esperaba

Tengo una aplicación web React con Ant design framework framework versión 4.

Traté de usar este ejemplo de Antd docs en mi aplicación web: https://codesandbox.io/s/ymspt

Pero no obtengo el mismo resultado cuando uso el código en mi aplicación web. Así es como se ve en mi aplicación

 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;

No tengo ningún css extra o lo que sea.

¿Cómo es que no obtengo el mismo resultado?

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

0

El problema fueron los componentes que he importado. Lo hice de la manera incorrecta.

Entonces, en lugar de

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

Tenía que hacer

 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!