Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[style] fix responsiveness in paper list view #1391

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 65 additions & 13 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ TODO
}

.tabnav-tab {
padding: 1em 1.6em;
padding: 1rem 1.6rem;
background: #fff;
color: #2E294E;
transition: background-color .3s ease-out;
Expand Down Expand Up @@ -575,16 +575,9 @@ TODO
padding: .25em .5em;
border-radius: .5em;
margin-left: .5em;

@media (max-width: 580px) {
background: none !important;
display: block;
text-align: center;
}
}



// Temp place for bootstrap variables
$font-family-sans-serif:'Inter',
-apple-system,
Expand Down Expand Up @@ -637,10 +630,51 @@ $btn-primary-border: darken($btn-primary-bg, 5%) !default;
}
}

.paper-header {
display: flex;
flex-direction: row;
justify-content: space-between;
gap: 0.5em;
height: calc(1.5em + 0.75rem + 2px); // same as bootstrap input height

@include media-breakpoint-down(md){
.form-inline {
margin-top: 0 !important; // bootstrap forces this as important
max-width: 50%
}
}
@include media-breakpoint-down(sm){
flex-direction: column;
height: unset;

.btn-group {
width: 100%;
display: flex;
.tabnav-tab {
flex-grow: 1;
justify-content: center;
}
}

.form-inline {
width: 100%;
max-width: unset;
.input-group {
width: 100%;
margin-bottom: 0 !important; // bootstrap forces important
}
}
}
}

.paper-list {
margin-top: 1.5em;
font-size: 14px;

@include media-breakpoint-down(sm){
margin-top: 0;
}

.paper-card {
background: #fff;
border-radius: .25em;
Expand Down Expand Up @@ -757,12 +791,30 @@ $btn-primary-border: darken($btn-primary-bg, 5%) !default;
border: 1px solid #EAE9ED;
font-size: 12px;

.tabnav-tab:first-of-type {
border-radius: 0.25em 0 0 0.25em;
}
.tabnav-tab {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
align-items: center;

.tabnav-tab:last-of-type {
border-radius: 0 0.25em 0.25em 0;
@include media-breakpoint-down(md){
padding-left: 0.5em;
padding-right: 0.5em;
}

@include media-breakpoint-down(sm){
flex-direction: column;
padding: 1em 1.5em;
}


&:first-of-type {
border-radius: 0.25em 0 0 0.25em;
}

&:last-of-type {
border-radius: 0 0.25em 0.25em 0;
}
}
}

Expand Down
14 changes: 8 additions & 6 deletions app/views/papers/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,20 @@

<div class="container">

<div class="paper-header">
<div class="btn-group" role="group" aria-label="Paper Status">

<%= link_to papers_path, class: "tabnav-tab #{selected_class('index')}" do %>
All Papers
<div class="count-badge"><%= raw Paper.public_everything.count %></div>
<span class="count-label">All Papers</span>
<div class="count-badge"><%= raw Paper.public_everything.count %></div>
<% end %>
<%= link_to published_papers_path, class: "tabnav-tab #{selected_class('popular')}" do %>
Published Papers
<div class="count-badge"><%= raw Paper.visible.count %></div>
<span class="count-label">Published Papers</span>
<div class="count-badge"><%= raw Paper.visible.count %></div>
<% end %>
<%= link_to active_papers_path, class: "tabnav-tab #{selected_class('active')}" do %>
Active Papers
<div class="count-badge"><%= raw Paper.public_in_progress.count %></div>
<span class="count-label">Active Papers</span>
<div class="count-badge"><%= raw Paper.public_in_progress.count %></div>
<% end %>
</div>

Expand All @@ -39,6 +40,7 @@
</div>
</div>
<% end %>
</div>

<div id ="primary-content row" class="paper-list">
<%= render partial: "list", locals: { papers: @papers } %>
Expand Down