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

Pagination fixup; Better Prettier handling of Jinja templates #97

Merged
merged 3 commits into from
Aug 2, 2024
Merged
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
2 changes: 1 addition & 1 deletion esbuild.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const postCSSPlugin = ({ plugins = [], lessOptions = {} }) => ({
math: "always",
paths: [
...readdirSync(`${modules}/@cfpb`).map(
(v) => `${modules}/@cfpb/${v}/src`
(v) => `${modules}/@cfpb/${v}/src`,
),
`${modules}`,
],
Expand Down
18 changes: 17 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,22 @@
"postcss-less": "^6.0.0"
},
"devDependencies": {
"prettier": "^2.7.1"
"prettier": "^3.3.3",
"prettier-plugin-jinja-template": "^1.4.1"
},
"prettier": {
"plugins": [
"prettier-plugin-jinja-template"
],
"overrides": [
{
"files": [
"*.html"
],
"options": {
"parser": "jinja-template"
}
}
]
}
}
8 changes: 6 additions & 2 deletions viewer/static_src/css/skip-nav.less
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
width: 1px;
overflow: hidden;
background: transparent;
transition: transform 1s ease, background 0.5s linear;
transition:
transform 1s ease,
background 0.5s linear;
z-index: 11;

&:focus {
Expand All @@ -25,7 +27,9 @@
width: auto;
overflow: visible;
outline: 0;
transition: transform 0.1s ease, background 0.2s linear;
transition:
transform 0.1s ease,
background 0.2s linear;
}

&--flush-left:focus {
Expand Down
2 changes: 1 addition & 1 deletion viewer/static_src/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Expandable } from "@cfpb/cfpb-expandables";
const docElement = document.documentElement;
docElement.className = docElement.className.replace(
/(^|\s)no-js(\s|$)/,
"$1$2"
"$1$2",
);

Expandable.init();
2 changes: 1 addition & 1 deletion viewer/templates/viewer/base.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% load static %}

<!DOCTYPE html>
<!doctype html>
<html lang="en" class="no-js">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
Expand Down
51 changes: 22 additions & 29 deletions viewer/templates/viewer/component_list.html
Original file line number Diff line number Diff line change
@@ -1,32 +1,25 @@
{% extends './base.html' %} {% load humanize %} {% block content %}
<div class="lead-paragraph">
{{ results | length | intcomma }} total
<a class="a-link a-link__icon" href="https://cfpb.github.io/design-system">
<span class="a-link__text">CFPB Design System</span>
<svg
class="cf-icon-svg"
viewBox="0 0 14 19"
xmlns="http://www.w3.org/2000/svg"
{% extends './base.html' %} {% load humanize %}
{% block content %}
<div class="lead-paragraph">
{{ results | length | intcomma }} total
<a class="a-link a-link__icon" href="https://cfpb.github.io/design-system">
<span class="a-link__text">CFPB Design System</span>
{% include "external-link.svg" %}</a
>
<path
d="M13.017 3.622v4.6a.554.554 0 0 1-1.108 0V4.96L9.747 7.122a1.65 1.65 0 0 1 .13.646v5.57A1.664 1.664 0 0 1 8.215 15h-5.57a1.664 1.664 0 0 1-1.662-1.663v-5.57a1.664 1.664 0 0 1 1.662-1.662h5.57A1.654 1.654 0 0 1 9 6.302l2.126-2.126H7.863a.554.554 0 1 1 0-1.108h4.6a.554.554 0 0 1 .554.554zM8.77 8.1l-2.844 2.844a.554.554 0 0 1-.784-.783l2.947-2.948H2.645a.555.555 0 0 0-.554.555v5.57a.555.555 0 0 0 .554.553h5.57a.555.555 0 0 0 .554-.554z"
></path>
</svg>
</a>
component{{ results | length | pluralize }}
</div>
component{{ results | length | pluralize }}
</div>

<div class="block block--flush-top">
<ul class="m-list">
{% for component in results %}
<li class="results_item">
<a
href="{% url 'index' %}?search_type=components&q={{ component.class_name | escape }}"
>
{{ component.class_name }}
</a>
</li>
{% endfor %}
</ul>
</div>
<div class="block block--flush-top">
<ul class="m-list">
{% for component in results %}
<li class="results_item">
<a
href="{% url 'index' %}?search_type=components&q={{ component.class_name | escape }}"
>
{{ component.class_name }}
</a>
</li>
{% endfor %}
</ul>
</div>
{% endblock content %}
Loading