Skip to content

Commit 2323215

Browse files
committed
Update navbar styling
1 parent 9daf6c1 commit 2323215

File tree

6 files changed

+105
-55
lines changed

6 files changed

+105
-55
lines changed

assets/FCC-logo-white.png

-5.68 KB
Binary file not shown.

assets/freeCodeCamp-logo-glyph.png

6.04 KB
Loading

assets/freeCodeCamp-logo.png

3.18 KB
Loading

src/LayoutComponents/search/SearchBar.jsx

+8-11
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import React, { PureComponent } from 'react';
22
import PropTypes from 'prop-types';
33
import { connect } from 'react-redux';
44
import { bindActionCreators } from 'redux';
5-
import Navbar from 'react-bootstrap/lib/Navbar';
65
import FormControl from 'react-bootstrap/lib/FormControl';
76

87
import {
@@ -77,17 +76,15 @@ class SearchBar extends PureComponent {
7776
searchTerm
7877
} = this.props;
7978
return (
80-
<div>
79+
<div className='searchBar'>
8180
<form onSubmit={ this.handleSubmit }>
82-
<Navbar.Form className='formContainer'>
83-
<FormControl
84-
className='input'
85-
onChange={ this.handleChange }
86-
placeholder='&#xf002; What would you like to know?'
87-
type='text'
88-
value={ searchTerm }
89-
/>
90-
</Navbar.Form>
81+
<FormControl
82+
className='input'
83+
onChange={ this.handleChange }
84+
placeholder='&#xf002; What would you like to know?'
85+
type='text'
86+
value={ searchTerm }
87+
/>
9188
</form>
9289
</div>
9390
);

src/css/main.css

+71-17
Original file line numberDiff line numberDiff line change
@@ -38,22 +38,87 @@
3838

3939
/* Layout */
4040

41-
.link {
42-
text-decoration: none;
43-
color: #fff;
41+
.content {
42+
margin-bottom: 50px;
4443
}
4544

45+
/* NavBar */
46+
4647
.navBar {
4748
background: #006400;
4849
display: flex;
4950
align-items: center;
50-
/* height: 40px; */
51+
min-height: 40px;
5152
border: none;
5253
border-radius: 0;
5354
}
5455

55-
.content {
56-
margin-bottom: 50px;
56+
.navContainer {
57+
display: flex;
58+
align-items: center;
59+
width: 100%;
60+
margin: 0 auto;
61+
padding: 0 15px;
62+
}
63+
64+
@media (min-width: 992px) {
65+
.navContainer {
66+
width: 970px;
67+
}
68+
}
69+
70+
@media (min-width: 1200px) {
71+
.navContainer {
72+
width: 1170px;
73+
}
74+
}
75+
76+
/* Navbar logo */
77+
78+
.logo-glyph {
79+
height: 30px;
80+
width: auto;
81+
}
82+
83+
.logo {
84+
display: none;
85+
}
86+
87+
.logoContainer {
88+
margin-right: 10px;
89+
}
90+
91+
@media (min-width: 992px) {
92+
.logo-glyph {
93+
display: none;
94+
}
95+
96+
.logo {
97+
display: block;
98+
}
99+
100+
.logoContainer {
101+
margin-right: 50px;
102+
width: 25%;
103+
}
104+
}
105+
106+
/* SearchBar */
107+
108+
.searchBar {
109+
width: 100%;
110+
}
111+
112+
@media (min-width: 992px) {
113+
.searchBar {
114+
width: 75%;
115+
}
116+
}
117+
118+
.input {
119+
min-width: 100%;
120+
width: 100%;
121+
height: 30px;
57122
}
58123

59124
/* NoResults/404 */
@@ -133,17 +198,6 @@
133198
background: #eee;
134199
}
135200

136-
/* SearchBar */
137-
138-
.formContainer {
139-
margin: 0;
140-
}
141-
142-
.input {
143-
min-width: 100%;
144-
width: 100%;
145-
}
146-
147201
/* SearchPage */
148202

149203
.resultIcon {

src/layouts/Layout.jsx

+26-27
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@ import PropTypes from 'prop-types';
33
import Col from 'react-bootstrap/lib/Col';
44
import Grid from 'react-bootstrap/lib/Grid';
55
import Image from 'react-bootstrap/lib/Image';
6-
import Navbar from 'react-bootstrap/lib/Navbar';
76
import Row from 'react-bootstrap/lib/Row';
87
import Link from 'gatsby-link';
98

109
import SearchBar from '../LayoutComponents/search/SearchBar.jsx';
1110
import SideNav from '../LayoutComponents/nav/SideNav.jsx';
1211

12+
import logo from '../../assets/freeCodeCamp-logo.png';
13+
import glyph from '../../assets/freeCodeCamp-logo-glyph.png';
14+
1315
import 'prismjs/themes/prism.css';
1416
import '../css/main.css';
1517

@@ -20,34 +22,31 @@ const propTypes = {
2022
};
2123

2224
function Layout(props) {
23-
2425
return (
2526
<div>
26-
<Grid fluid={ true }>
27-
<Row>
28-
<Navbar className='navBar'>
29-
<Col md={ 3 } xs={ 12 }>
30-
<Link
31-
className='link'
32-
to={ '/' }
33-
>
34-
<Image
35-
alt='freeCodeCamp logo'
36-
responsive={ true }
37-
src={
38-
'https://raw.githubusercontent.com/' +
39-
'freeCodeCamp/assets/master/assets/' +
40-
'logos/FCC-logo-white.png'
41-
}
42-
/>
43-
</Link>
44-
</Col>
45-
<Col md={ 9 } xs={ 12 }>
46-
<SearchBar />
47-
</Col>
48-
</Navbar>
49-
</Row>
50-
</Grid>
27+
<nav className='navbar navBar'>
28+
<div className='navContainer'>
29+
<div className='logoContainer'>
30+
<Link
31+
className='link'
32+
to={ '/' }
33+
>
34+
<Image
35+
alt='freeCodeCamp logo'
36+
className='logo'
37+
responsive={ true }
38+
src={ logo }
39+
/>
40+
<Image
41+
alt='freeCodeCamp logo'
42+
className='logo-glyph'
43+
src={ glyph }
44+
/>
45+
</Link>
46+
</div>
47+
<SearchBar />
48+
</div>
49+
</nav>
5150
<Grid>
5251
<Row>
5352
<Col md={ 4 }>

0 commit comments

Comments
 (0)