WIP Add styling for mobile table

This commit is contained in:
igorkorenfeld 2023-01-30 18:23:29 -05:00
parent 5871431268
commit a0e1ce7086
No known key found for this signature in database
GPG key ID: 826947A4B867F659
2 changed files with 66 additions and 36 deletions

View file

@ -19,7 +19,8 @@ i.e.
@include u-padding-right('05'); @include u-padding-right('05');
---------------------------------------- ----------------------------------------
*/ */
// USWDS tokens are a bit too coarse in their letter-spacing steps
// Finer grained letterspacing adjustments
$letter-space--xs: .0125em; $letter-space--xs: .0125em;
@use "uswds-core" as *; @use "uswds-core" as *;
@ -37,6 +38,7 @@ $letter-space--xs: .0125em;
h1 { h1 {
@include typeset('sans', '2xl', 2); @include typeset('sans', '2xl', 2);
margin: 0 0 units(2); margin: 0 0 units(2);
color: color('primary-darker');
} }
h2 { h2 {
@ -56,13 +58,15 @@ $letter-space--xs: .0125em;
margin-bottom: 0; margin-bottom: 0;
} }
.register-form-step p { .register-form-step p,
.dashboard p {
@include typeset('sans', 'sm', 5); @include typeset('sans', 'sm', 5);
max-width: measure(5); max-width: measure(5);
&:last-of-type { //TODO: Revisit
margin-bottom: 0; // &:last-of-type {
} // margin-bottom: 0;
// }
} }
.register-form-step a { .register-form-step a {
@ -120,6 +124,20 @@ a.breadcrumb__back {
background-color: color('primary-lightest'); background-color: color('primary-lightest');
} }
//TODO: Move into dashboard; Change color for table heads on mobile
//check if better to use usa-table--sortable and usa-table--stacked as targets
.usa-table--stacked tr th {
border-top: 1px solid pink;
}
.usa-table--stacked tr:first-child th:first-child {
border-top: none;
}
.usa-table--stacked tr {
border-bottom: none;
border-top: 2px solid color('base-light');
margin-top: units(2);
}
section.dashboard { section.dashboard {
background-color: color('white'); background-color: color('white');
border: 1px solid color('base-lighter'); border: 1px solid color('base-lighter');
@ -136,29 +154,7 @@ section.dashboard {
} }
.usa-table { .usa-table {
td, th { width: 100%;
border: 0; //reset border
border-bottom: 1px solid color('base-light');
}
thead th {
color: color('primary-darker');
border-bottom: 2px solid color('base-light');
}
tbody tr:last-of-type {
td, th {
border-bottom: 0;
}
}
td {
padding: units(2);
}
th:first-of-type {
padding-left: 0;
}
a, a:visited { a, a:visited {
color: color('primary'); color: color('primary');
@ -166,7 +162,7 @@ section.dashboard {
a { a {
display: flex; display: flex;
align-item: flex-start; align-items: flex-start;
.usa-icon { .usa-icon {
// align icon with x height // align icon with x height
@ -174,6 +170,40 @@ section.dashboard {
margin-right: units(0.5); margin-right: units(0.5);
} }
} }
td, th {
padding: units(2px) 0;
border: none;
}
}
@include at-media(tablet) {
.usa-table {
td, th {
// border: none; //reset border
border-bottom: 1px solid color('base-light');
}
thead th {
color: color('primary-darker');
border-bottom: 2px solid color('base-light');
}
tbody tr:last-of-type {
td, th {
border-bottom: 0;
}
}
td {
padding: units(2);
}
th:first-of-type {
padding-left: 0;
}
}
} }
} }

View file

@ -9,7 +9,7 @@
{% if user.is_authenticated %} {% if user.is_authenticated %}
{# complete logged in page together here #} {# complete logged in page together here #}
<div class="tablet:grid-offset-1"> <div class="tablet:grid-offset-2">
<h1>Manage your domains</h2> <h1>Manage your domains</h2>
<p><a href="{% url 'application:' %}" class="usa-button">Start a new domain request</a></p> <p><a href="{% url 'application:' %}" class="usa-button">Start a new domain request</a></p>
@ -23,7 +23,7 @@
{{ domain }} {{ domain }}
{% endfor %} {% endfor %}
{% else %} {% else %}
You don't have any registered domains yet <p>You don't have any registered domains yet</p>
{% endif %} {% endif %}
</section> </section>
</div> </div>
@ -32,7 +32,7 @@
<section class="dashboard"> <section class="dashboard">
<h2>Active domain requests</h2> <h2>Active domain requests</h2>
{% if domain_applications %} {% if domain_applications %}
<table class="usa-table usa-table--borderless"> <table class="usa-table usa-table--borderless usa-table--stacked">
<caption class="sr-only">Your domain applications</caption> <caption class="sr-only">Your domain applications</caption>
<thead> <thead>
<tr> <tr>
@ -45,11 +45,11 @@
<tbody> <tbody>
{% for application in domain_applications %} {% for application in domain_applications %}
<tr> <tr>
<th th scope="row" role="rowheader"> <th th scope="row" role="rowheader" data-label="Domain name">
{{ application.requested_domain.name|default:"New domain request" }} {{ application.requested_domain.name|default:"New domain request" }}
</th> </th>
<td data-sort-value="{{ application.created_at|date:"U" }}">{{ application.created_at|date }}</td> <td data-sort-value="{{ application.created_at|date:"U" }}" data-label="Date created">{{ application.created_at|date }}</td>
<td>{{ application.status|title }}</td> <td data-label="Status">{{ application.status|title }}</td>
<td> <td>
<a href="{% url 'edit-application' application.pk %}"> <a href="{% url 'edit-application' application.pk %}">
{% if application.status == "started" %} {% if application.status == "started" %}