Skip to content

Commit d8a9727

Browse files
committed
feat(Navbar): support sticky prop on navbar
1 parent d82bebb commit d8a9727

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

src/Navbar.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const propTypes = {
77
inverse: PropTypes.bool,
88
full: PropTypes.bool,
99
fixed: PropTypes.string,
10+
sticky: PropTypes.string,
1011
color: PropTypes.string,
1112
role: PropTypes.string,
1213
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
@@ -40,6 +41,7 @@ const Navbar = (props) => {
4041
inverse,
4142
full,
4243
fixed,
44+
sticky,
4345
color,
4446
tag: Tag,
4547
...attributes
@@ -54,7 +56,8 @@ const Navbar = (props) => {
5456
'navbar-inverse': inverse,
5557
[`bg-${color}`]: color,
5658
'navbar-full': full,
57-
[`navbar-fixed-${fixed}`]: fixed
59+
[`navbar-fixed-${fixed}`]: fixed,
60+
[`sticky-${sticky}`]: sticky,
5861
}
5962
), cssModule);
6063

src/__tests__/Navbar.spec.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,14 @@ describe('Navbar', () => {
4141
});
4242

4343
it('should render prop based classes', () => {
44-
const wrapper = shallow(<Navbar light inverse toggleable="sm" color="success" full fixed="top" />);
44+
const wrapper = shallow(<Navbar light inverse toggleable="sm" color="success" full sticky="top" fixed="top" />);
4545

4646
expect(wrapper.hasClass('bg-success')).toBe(true);
4747
expect(wrapper.hasClass('navbar')).toBe(true);
4848
expect(wrapper.hasClass('navbar-toggleable-sm')).toBe(true);
4949
expect(wrapper.hasClass('navbar-light')).toBe(true);
5050
expect(wrapper.hasClass('navbar-inverse')).toBe(true);
5151
expect(wrapper.hasClass('navbar-fixed-top')).toBe(true);
52+
expect(wrapper.hasClass('sticky-top')).toBe(true);
5253
});
5354
});

0 commit comments

Comments
 (0)