Skip to content

Commit 8325d62

Browse files
authored
Refactored header and fixed tests (#1036)
1 parent bc000ac commit 8325d62

File tree

6 files changed

+467
-390
lines changed

6 files changed

+467
-390
lines changed

app/assets/stylesheets/_header.scss

Lines changed: 63 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
1+
@import "variables";
2+
@import "typography";
3+
@import "bootstrap";
4+
15
#header {
26
padding: 0px;
3-
background-color: #000000;
4-
.body{
5-
color: #ffffff;
6-
margin: auto;
7-
padding: 50px 25px 25px 25px;
8-
float: right;
9-
display: -webkit-inline-box;
10-
}
7+
background-color: $black;
8+
119
.navbar-brand {
12-
color: #ffffff;
10+
color: $white;
1311
margin: auto;
1412
padding: 10px;
1513
}
1614
.btn.btn-warning.btn-sm {
17-
--bs-btn-bg: #ffc107;
15+
--bs-btn-bg: #FBC129;
1816
padding-left: 10px;
1917
margin-left: 10px;
18+
font-family: "Libre Franklin";
19+
font-size: 16px;
20+
color: $black;
2021
}
2122
}
2223
.container-fluid {
@@ -36,4 +37,56 @@
3637
.gutter {
3738
width: 20px;
3839
// border: 1px solid #00FF00;
40+
}
41+
42+
.header-row {
43+
width: 100% !important;
44+
}
45+
46+
.header-logo {
47+
padding-left: 20px;
48+
}
49+
50+
#header-navigation {
51+
color: $white;
52+
margin: auto;
53+
padding: 50px 25px 25px 25px;
54+
float: right;
55+
display: -webkit-inline-box;
56+
font-family: "Libre Franklin";
57+
.navbar-item {
58+
color: $white;
59+
font-family: "Libre Franklin";
60+
font-size: 16px;
61+
font-style: normal;
62+
line-height: 24px;
63+
font-weight: 600;
64+
margin-left: 12px;
65+
margin-right: 12px;
66+
}
67+
.navbar-item a {
68+
color: $white;
69+
font-family: "Libre Franklin";
70+
font-size: 16px;
71+
font-style: normal;
72+
line-height: 24px;
73+
font-weight: 600;
74+
margin-left: 12px;
75+
margin-right: 12px;
76+
text-decoration: none;
77+
}
78+
.navbar-item a:hover {
79+
text-decoration: underline;
80+
}
81+
.dropdown-menu {
82+
left: -45px;
83+
}
84+
85+
.dropdown-menu a {
86+
color: $black;
87+
font-weight: 400;
88+
}
89+
.dropdown-menu a:hover {
90+
width: 85%;
91+
}
3992
}

app/views/layouts/application.html.erb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@
6666
</div>
6767

6868
<%= render partial: 'shared/footer' %>
69-
69+
<script>
70+
$(document).ready(function (){
71+
$('#dropdownMenuButton').click(function () {
72+
$('.dropdown-toggle').dropdown('toggle');
73+
});
74+
});
75+
</script>
7076
</body>
7177
</html>

app/views/shared/_header.html.erb

Lines changed: 36 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,37 @@
1-
<nav>
2-
<div class="lux">
3-
<% if current_user %>
4-
<lux-library-header abbr-name="TD" theme="dark">
5-
<template v-slot:logo> <a href="/"><%= image_tag("TigerData-LOGO-KO_wide2.svg", alt: "TigerData logo", size: "150x100", id: "logo") %></a> </template>
6-
<lux-menu-bar type="main-menu" :menu-items="[
7-
{name: 'Contact US', component: 'Home', href: 'mailto:[email protected]'},
8-
{name: 'FAQ', component: 'Home', href: 'https://tigerdata.princeton.edu/frequently-asked-questions'},
9-
{name: '<%= current_user.display_name %>', component: 'Account', href: '/account/', children: [
10-
{name: 'Account Settings', component: 'Account', href: '/'},
11-
{name: 'Logout', component: 'Logout', href: '<%= main_app.destroy_user_session_path %> '}
12-
]}
13-
]"
14-
></lux-menu-bar>
15-
</lux-library-header>
16-
<% else %>
17-
<lux-library-header abbr-name="TD" theme="dark">
18-
<template v-slot:logo><a href="/"><%= image_tag("TigerData-LOGO-KO_wide2.svg", alt: "TigerData logo", size: "150x100", id: "logo") %></a> </template>
19-
<%= button_to "Log In", user_cas_omniauth_authorize_path, class: "btn btn-warning btn-sm" %>
20-
</lux-library-header>
21-
<% end %>
1+
<header>
2+
<div id="header">
3+
<nav class="navbar navbar-expand-lg">
4+
5+
<div class="row header-row">
6+
7+
<div class="col-lg-3 header-logo">
8+
<a href="/"><%= image_tag("TigerData-LOGO-KO_wide2.svg", alt: "TigerData logo", size: "150x100", id: "logo") %></a>
229
</div>
23-
</nav>
10+
11+
<div class="col-lg-9">
12+
<div id="header-navigation">
13+
<ul class="navbar-nav">
14+
<li class="navbar-item"><%= link_to "Contact Us", "mailto:[email protected]", class: "navbar-contact-us" %></li>
15+
<li class="navbar-item"><%= link_to "FAQ", "https://tigerdata.princeton.edu/frequently-asked-questions", class: "navbar-faq" %></li>
16+
<% if current_user %>
17+
<li class="navbar-item dropdown">
18+
<a class="dropdown-toggle" href="#" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
19+
<%= current_user.uid%>
20+
</a>
21+
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
22+
<%= link_to "Log out", main_app.destroy_user_session_path, class: "dropdown-item" %>
23+
</div>
24+
</li>
25+
<% else %>
26+
<li class="navbar-item"><%= button_to "Log in", user_cas_omniauth_authorize_path, class: "btn btn-warning btn-sm" %></li>
27+
<% end %>
28+
</ul>
29+
</div>
30+
</div>
31+
32+
33+
</div>
34+
35+
</nav>
36+
</div>
37+
</header>

0 commit comments

Comments
 (0)