Skip to content

Commit 580d88f

Browse files
committed
fix/Format profile page
1 parent 98fba3b commit 580d88f

File tree

3 files changed

+33
-40
lines changed

3 files changed

+33
-40
lines changed

app/javascript/stylesheets/application.scss

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ pre {
6666
&-tertiary {
6767
@extend .button--cta;
6868

69-
@apply bg-white text-cyan border-cyan;
69+
@apply bg-white text-cyan border-cyan hover:bg-cyan-light;
7070
}
7171
}
7272

@@ -83,21 +83,5 @@ pre {
8383
@extend .button;
8484

8585
@apply border-gray-500 text-gray-500 hover:bg-cyan-light;
86-
}
87-
88-
89-
// FOLLOW
90-
&--follow {
91-
@extend .button;
92-
93-
@apply border-cyan text-cyan hover:bg-cyan-light;
94-
}
95-
96-
// UNFOLLOW
97-
&--unfollow {
98-
@extend .button;
99-
100-
@apply bg-cyan text-white border-cyan;
101-
}
102-
86+
}
10387
}
Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
<div data-controller="follow" data-follow-target="container" data-follow-id-value="<%= user.id %>">
1+
<div
2+
data-controller="follow"
3+
data-follow-target="container"
4+
data-follow-id-value="<%= user.id %>"
5+
>
26
<% if user_signed_in? && current_user == user %>
37
<%# Don't display anything if the current user is the same as the user being viewed %>
48
<% elsif user_signed_in? %>
59
<% if current_user.following?(user) %>
6-
<%= button_tag 'Following', data: { action: 'click->follow#unfollow' }, class: "button--unfollow" %>
10+
<%= button_tag 'Following', data: { action: 'click->follow#unfollow' }, class: "button--cta-primary mt-2 flex w-full justify-center" %>
711
<% else %>
8-
<%= button_tag 'Follow', data: { action: 'click->follow#follow' }, class: "button--follow" %>
12+
<%= button_tag 'Follow', data: { action: 'click->follow#follow' }, class: "button--cta-tertiary mt-2 flex w-full justify-center" %>
913
<% end %>
1014
<% else %>
11-
<%= button_tag 'Follow', type: :button, class: "button--follow", data: { controller: 'modal', modal_url_value: sign_in_sign_up_modals_users_path, action: "click->modal#present" } %>
15+
<%= button_tag 'Follow', type: :button, class: "button--cta-tertiary mt-2 flex w-full justify-center", data: { controller: 'modal', modal_url_value: sign_in_sign_up_modals_users_path, action: "click->modal#present" } %>
1216
<% end %>
1317
</div>

app/views/users/show.html.erb

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,33 @@
33
<% end %>
44

55
<div class="card--container card--container-padding">
6-
<div class="flex v-center">
6+
<div class="flex">
77
<div class="flex flex-column">
88
<img style="border-radius: 50%;" src="<%= @user.avatar_url %>" height="120" width="120" />
9+
<% if @user == current_user %>
10+
<%= button_to 'Edit Profile', edit_user_registration_path, method: :get, class: 'mt-2 button--cta-tertiary flex w-full justify-center' %>
11+
<% else %>
12+
<%= render partial: 'users/follow_button', locals: { user: @user } %>
13+
<% end %>
914
</div>
10-
<div class="margin-left">
15+
<div class="ml-4 mt-4">
1116
<h2 class="users-show--name"><%= @user.name %></h2>
1217
<div style="height: 40px;">
1318
<span><%= @user.bio %></span>
1419
</div>
1520
</div>
1621
</div>
17-
18-
<div class="margin-top flex space-between">
19-
<% if @user == current_user %>
20-
<%= button_to 'EDIT PROFILE', edit_user_registration_path, method: :get, class: 'button--cta-follow' %>
21-
<% else %>
22-
<%= render partial: 'users/follow_button', locals: { user: @user } %>
23-
<% end %>
24-
</div>
2522
</div>
2623

2724
<div data-controller="tabs">
2825
<div class="tabs--headers-container">
2926
<div></div>
3027
<div class="tabs--headers-wrapper">
3128
<div data-target="tabs.tab" data-tab-id="snippets" data-action="click->tabs#change" class="tabs--header <%= tabs_class_for_active_tab(:snippets, @tab_id) %>">
32-
<span><%= @user.filed_snippets.size %> Snippets</span>
29+
<span><%= pluralize(@user.filed_snippets.size, 'Snippet') %></span>
3330
</div>
3431
<div data-target="tabs.tab" data-tab-id="followers" data-action="click->tabs#change" class="tabs--header <%= tabs_class_for_active_tab(:followers, @tab_id) %>">
35-
<span><%= @followers.size %> Followers</span>
32+
<span><%= pluralize(@followers.size, 'Follower') %></span>
3633
</div>
3734
<div data-target="tabs.tab" data-tab-id="following" data-action="click->tabs#change" class="tabs--header <%= tabs_class_for_active_tab(:following, @tab_id) %>">
3835
<span><%= @following.size %> Following</span>
@@ -70,15 +67,23 @@
7067
</div>
7168
</div>
7269

73-
<div data-tabs-target="panel" class="<%= tabs_details_class_for_active_tab(:followers, @tab_id) %>">
74-
<% @followers.each do |follower| %>
75-
<%= render partial: 'follow_preview', locals: { user: follower } %>
70+
<div data-tabs-target="panel" class="mt-4 <%= tabs_details_class_for_active_tab(:followers, @tab_id) %>">
71+
<%= render 'shared/cards/card_no_padding' do %>
72+
<ul class="divide-y divide-gray-200">
73+
<% @followers.each do |follower| %>
74+
<%= render partial: 'follow_preview', locals: { user: follower } %>
75+
<% end %>
76+
</ul>
7677
<% end %>
7778
</div>
7879

79-
<div data-tabs-target="panel" class="<%= tabs_details_class_for_active_tab(:following, @tab_id) %>">
80-
<% @following.each do |following| %>
81-
<%= render partial: 'follow_preview', locals: { user: following } %>
80+
<div data-tabs-target="panel" class="mt-4 <%= tabs_details_class_for_active_tab(:following, @tab_id) %>">
81+
<%= render 'shared/cards/card_no_padding' do %>
82+
<ul class="divide-y divide-gray-200">
83+
<% @following.each do |following| %>
84+
<%= render partial: 'follow_preview', locals: { user: following } %>
85+
<% end %>
86+
</ul>
8287
<% end %>
8388
</div>
8489
</div>

0 commit comments

Comments
 (0)