Skip to content

Commit

Permalink
Improve sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
hunchr committed Nov 5, 2024
1 parent 64788bc commit 5b4ec25
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 36 deletions.
64 changes: 34 additions & 30 deletions app/assets/stylesheets/hotsheet/application.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,44 +8,45 @@
*/

:root {
--sidebar-width: 300px;
--table-border-color: #E0E1DD;
--table-header-bg-color: #778DA9;
--bg-color: lightgray;
--sidebar-width: 12rem;
}

body {
font-family: 'Montserrat', sans-serif;
font: 400 16px system-ui, Roboto, Helvetica, Arial, sans-serif;
margin: 0;
}

main {
margin-left: var(--sidebar-width);
padding: 1rem 2rem;
padding: 1rem;
}

.sidebar {
width: var(--sidebar-width);
aside {
background-color: var(--bg-color);
border-right: 1px solid gray;
height: 100%;
left: 0;
overflow-y: auto;
position: fixed;
top: 0;
bottom: 0;
left: 0;
z-index: 1000;
background-color: lightgray;
border-right: 1px solid gray;
width: var(--sidebar-width);

.nav-list {
ul {
display: flex;
flex-direction: column;
gap: 0.5rem;
list-style: none;
padding: 1rem 0.5rem;
margin: 0;
padding: 0.25rem;

.nav-item {
padding: 0.5rem 2rem;
border-radius: 5px;
text-decoration: none;
a {
border-radius: 0.5rem;
color: green;
font-weight: bold;
font-size: 1.5rem;
font-weight: 700;
overflow: hidden;
padding: 0.5rem;
text-decoration: none;
text-overflow: ellipsis;
white-space: nowrap;

&:hover {
background-color: darkgray;
Expand All @@ -54,29 +55,32 @@ main {
}
}

h1 {
margin: 0 0 1rem 0;
}

table {
border-collapse: collapse;

th {
background-color: var(--table-border-color);
border-color: black;
th,
td {
border: 1px solid var(--bg-color);
padding: 0.5rem;
text-align: left;
}

th, td {
border: 1px solid var(--table-border-color);
padding: .5rem;
th {
background-color: var(--bg-color);
}

.readonly-attribute {
min-width: 1rem;
min-height: 1rem;
min-width: 1rem;
}

.editable-input {
border: none;
background-color: transparent;
border: none;
width: 100%;
}
}
2 changes: 1 addition & 1 deletion app/views/hotsheet/pages/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<h1>Hotsheet</h1>
<p>Welcome to the hottest sheet around. Select a model from the sidebar to view the spreadsheet.</p>
<% else %>
<h1><%= @model %></h1>
<h1><%= @model.model_name.human %></h1>
<table>
<thead>
<tr>
Expand Down
7 changes: 3 additions & 4 deletions app/views/layouts/hotsheet/_sidebar.html.erb
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<%# locals: () %>

<aside class="sidebar">
<aside>
<nav>
<ul class="nav-list">
<%= link_to t("home"), root_path, class: "nav-item" %>
<ul>
<% Hotsheet.models.each do |model| %>
<%= link_to model.model_name.human, polymorphic_path(model.table_name), class: "nav-item" %>
<%= link_to model.model_name.human, polymorphic_path(model.table_name) %>
<% end %>
</ul>
</nav>
Expand Down
5 changes: 4 additions & 1 deletion app/views/layouts/hotsheet/application.html.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<!DOCTYPE html>
<html>
<html lang="<%= I18n.locale %>">
<head>
<title>Hotsheet</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="robots" content="noindex,nofollow">
<meta name="turbo-prefetch" content="false">
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<%= stylesheet_link_tag "hotsheet/application" %>
Expand Down

0 comments on commit 5b4ec25

Please sign in to comment.