Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 866
mjones Avatar asked Jan 06 '17 07:01

mjones


1 Answers

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..

like image 132
nirsky Avatar answered Oct 04 '22 07:10

nirsky