Skip to content

Commit bd00488

Browse files
committed
feature/Add user image and name to sidebar
1 parent 30da8d4 commit bd00488

File tree

6 files changed

+41
-40
lines changed

6 files changed

+41
-40
lines changed

app/assets/stylesheets/_sidebar.scss

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,39 @@
22

33
.sidebar {
44
&--wrapper {
5-
// background-color: snow;
6-
// height: 400px;
7-
// border: 1px solid lightgrey;
8-
// margin: 16px;
9-
position: sticky;
10-
position: -webkit-sticky;
11-
top: 16px;
12-
// display: flex;
13-
// flex-direction: column;
14-
// background-color: white;
15-
border-radius: 2px;
16-
// box-shadow: 0 4px 9px lightgrey;
17-
// padding: 16px 0px 16px 0px;
18-
// margin-top: 15px;
5+
position: fixed;
6+
top: 52px;
197
margin-right: 15px;
208
}
9+
10+
&--new-snippet {
11+
color: $color-primary;
12+
}
2113
}
2214

2315
.menu-button {
2416
&--wrapper {
2517
display: flex;
26-
height: 90px;
2718
width: 180px;
2819
}
2920

21+
&--icon {
22+
23+
}
24+
25+
&--name {
26+
margin-left: 18px;
27+
}
28+
3029
&--item {
3130
flex: 1;
31+
display: flex;
32+
align-items: center;
3233
text-align: center;
3334
color: $color-black;
3435
font-weight: 100;
3536
font-size: 15px;
36-
// border: 1px solid lightgrey;
37-
// border-radius: 4px;
38-
// background-color: white;
39-
// box-shadow: 0 4px 9px lightgrey;
40-
// margin-right: 8px;
41-
padding: 16px 0px;
37+
padding:8px;
4238
text-decoration: none;
4339

4440
&:hover {

app/assets/stylesheets/base.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pre {
1414
margin: 16px 18px;
1515
}
1616

17-
h2, span, p { font-weight: 100; }
17+
h2, h3, span, p { font-weight: 100; }
1818

1919
a {
2020
text-decoration: none;
@@ -44,12 +44,12 @@ input[type=text] {
4444
height: 52px;
4545
max-height: 52px;
4646
background-color: $color-white;
47-
border-bottom: 1px solid $color-light;
4847
position: relative;
4948
position: -webkit-sticky; /* Safari */
5049
position: sticky;
5150
top: 0;
5251
z-index: 2;
52+
box-shadow: 0 1px 4px lightgrey;
5353
}
5454

5555
#header-wrapper {

app/assets/stylesheets/card.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
&--container {
55
background-color: $color-white;
66
border-radius: 2px;
7-
border: 1px solid $color-light;
7+
// border: 1px solid $color-light;
88
margin: 16px 0px;
99
padding: 16px 8px;
10+
box-shadow: 0 1px 4px lightgrey;
1011

1112
&-padding {
1213
padding: 16px;

app/views/layouts/application.html.erb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@
2323
<alert></alert>
2424
<popover></popover>
2525

26+
<%= render partial: 'shared/topbar' %>
27+
2628
<div id="app">
2729
<div style="display: flex;">
28-
<div style="flex: 1">
30+
<div style="flex: 1; margin-right: 16px;">
2931
<%= render 'shared/sidebar' %>
3032
</div>
3133
<div style="flex: 4;">

app/views/shared/_sidebar.html.erb

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,34 @@
11
<div class="sidebar--wrapper">
2-
<card style="text-align: center;">
3-
<span>SNIPPET.IO</span>
4-
</card>
52
<% if user_signed_in? %>
63
<card>
4+
<div style="text-align: center;">
5+
<img src="https://media-exp1.licdn.com/dms/image/C4E03AQG0MUNjxFvBTw/profile-displayphoto-shrink_200_200/0?e=1593648000&v=beta&t=WnnJ_Q6MpQFur5Uev2iqeLAnoX6Rdb1Bv6RoAijK3tA" style="border-radius: 50%; display: block; margin: 0 auto;" width=80">
6+
<h3 style="margin: 8px 0px 0px 0px;"><%= current_user.name %></h2>
7+
</div>
8+
<div class="horizontal-line"></div>
79
<div class="menu-button--wrapper">
810
<%= link_to root_path, class: request.fullpath == root_path ? 'menu-button--item-active' : 'menu-button--item' do %>
9-
<img src="/icons/home.svg" width="28">
10-
<span style="display: block; margin-top: 8px;">Home</span>
11-
<% end %>
12-
<%= link_to new_snippet_path, class: request.fullpath == new_snippet_path ? 'menu-button--item-active' : 'menu-button--item' do %>
13-
<img src="/icons/edit.svg" width="28">
14-
<span style="display: block; margin-top: 8px;">New Snippet</span>
11+
<img class="menu-button--icon" src="/icons/home.svg" width="20">
12+
<span class="menu-button--name">Home</span>
1513
<% end %>
1614
</div>
1715
<div class="menu-button--wrapper">
1816
<%= link_to folders_path, class: request.fullpath == folders_path ? 'menu-button--item-active' : 'menu-button--item' do %>
19-
<img src="/icons/folder-1.svg" width="28">
20-
<span style="display: block; margin-top: 8px;">Folders</span>
17+
<img class="menu-button--icon" src="/icons/folder-1.svg" width="20">
18+
<span class="menu-button--name">Folders</span>
2119
<% end %>
20+
</div>
21+
<div class="menu-button--wrapper">
2222
<%= link_to edit_user_registration_path, class: request.fullpath == edit_user_registration_path ? 'menu-button--item-active' : 'menu-button--item' do %>
23-
<img src="/icons/settings.svg" width="28">
24-
<span style="display: block; margin-top: 8px;">Settings</span>
23+
<img class="menu-button--icon" src="/icons/settings.svg" width="20">
24+
<span class="menu-button--name">Settings</span>
2525
<% end %>
2626
</div>
2727
</card>
2828
<card style="text-align: center;">
29-
<%= link_to('NEW SNIPPET', new_snippet_path, class: "button--cta-new") %>
29+
<%= link_to(new_snippet_path, class: 'sidebar--new-snippet') do %>
30+
<span>NEW SNIPPET</span>
31+
<% end %>
3032
</card>
3133
<% else %>
3234
<%# temp fix for when user not signed in %>

app/views/shared/_topbar.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div id="header">
2-
<div id="header-wrapper">
2+
<div id="header-wrapper" style="position: relative;">
33
<div style="display: flex; align-items: center;">
44
<a class="button--cta-transparent" href="/">SNIPPET.IO</a>
55
</div>

0 commit comments

Comments
 (0)