Skip to content

Commit a3b01cd

Browse files
committed
contain the logo in the navbar
previously, wide logo's would overflow the width of the Navbar.Brand. this commit adds height to the brand element, instead of the logo image, containing the logo height and width within the Navbar.Brand. there isn't a bootstrap element that sets height to a specific value. the choice was to use inline styles or create a new class. I opted to create a new class. it's specific to the Header component so it's not in globals.scss. the name "custom-navbar-brand" makes it easier to denote that it's our class and not bootstrap's when inspecting from the browser. - ref: #209
1 parent 46cbcc0 commit a3b01cd

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/compounds/Header/Header.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@ import React from 'react'
22
import PropTypes from 'prop-types'
33
import { Container, Nav, Navbar } from 'react-bootstrap'
44
import Logo from '../Logo/Logo'
5+
import './styles.scss'
56

67
const Header = ({ auth, linkColor, logo, navLinks, userSession }) => {
78
const { src, alt } = logo
89

910
return (
1011
<Navbar bg='primary' expand='lg'>
1112
<Container>
12-
<Navbar.Brand className='w-50'>
13-
<Logo src={src} alt={alt} height={45} />
13+
<Navbar.Brand className='w-75 custom-navbar-brand'>
14+
<Logo src={src} alt={alt} height='auto' addClass='mw-100 mh-100' />
1415
</Navbar.Brand>
1516
<Navbar.Toggle aria-controls='basic-navbar-nav' />
1617
<Navbar.Collapse id='basic-navbar-nav'>

src/compounds/Header/styles.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.custom-navbar-brand {
2+
height: 45px;
3+
}

0 commit comments

Comments
 (0)