我有一个 react.js 项目,我想链接侧边栏菜单,如下图所示。当任何用户单击侧菜单项时,它可以链接他们的身体。我在互联网上搜索了很多材料,它们很容易,但我不知道如何应用这个项目,任何想法将不胜感激。
截屏:
应用程序.js:
function App() {
return (
<div className="App">
<Router>
<>
<Header/>
<AppBody>
<Sidebar/>
<Switch>
<Route path="/" exact>
<Chat/>
</Route>
</Switch>
</AppBody>
</>
</Router>
</div>
);}
聊天.js:
function Chat() {
return <ChatContainer>
<h1>Chat screen will be here</h1>
<ChatInput/>
</ChatContainer>
}
export default Chat;
侧边栏.js:
function Sidebar() {
return (
<SidebarContainer>
<SidebarHeader>
<SidebarInfo>
<h2>React</h2>
<h3>
<FiberManualRecordIcon/>
soft
</h3>
</SidebarInfo>
<CreateIcon/>
</SidebarHeader>
<SidebarOption Icon={InsertCommentIcon} title="Threads"/>
<SidebarOption Icon={InboxIcon} title="Mentions & reactions"/>
<SidebarOption Icon={DraftsIcon} title="Saved items"/>
<SidebarOption Icon={BookmarkBorderIcon} title="Channel browser"/>
<SidebarOption Icon={PeopleAltIcon} title="People & user groups"/>
<SidebarOption Icon={AppsIcon} title="Apps"/>
<SidebarOption Icon={FileCopyIcon} title="File browser"/>
<SidebarOption Icon={ExpandLessIcon} title="Show less"/>
<hr/>
<SidebarOption Icon={ExpandMoreIcon} title="Channels"/>
<hr/>
<SidebarOption Icon={AddIcon} addChannelOption title="Add Channels"/>
</SidebarContainer>
)}
export default Sidebar;