Best Practices for NavBar Branding in React-Bootstrap / React-Router-Bootstrap

有些话、适合烂在心里 提交于 2019-12-07 03:41:54

问题


There is an issue regarding anchor tags in React Bootstrap and React Router. I was curious on how other people have handled the situation. It is possible to just leave an anchor tag with an href such as <a href="/">Site Title</a> and avoid using IndexLinkContainer. There is also using MenuItem such as.

<Navbar.Brand>
    <IndexLinkContainer to={{pathname: '/'}}>
          <MenuItem>TitleName</MenuItem>
     </IndexLinkContainer>
 </Navbar.Brand>

However this leaves a hidious looking bullet point to the far left of the navbar. If anyone else has any ideas on how to tackle this I would appreciate it.


回答1:


That's what I did (with LinkContainer from react-router-bootstrap):

        <LinkContainer to="/" style={{ cursor: 'pointer' }}>
            <Navbar.Brand>
                <span style={{ width: 95 }}>Some text</span>
                <img  src="somesrc" style={{ height:20, float:'right', marginLeft:10 }}/>
            </Navbar.Brand>
        </LinkContainer>

Contains site's name and logo. No bullet point but I couldn't find a way to avoid using LinkContainer..



来源:https://stackoverflow.com/questions/41500890/best-practices-for-navbar-branding-in-react-bootstrap-react-router-bootstrap

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!