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

Add selected facet component #36

Merged
merged 1 commit into from
Sep 3, 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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Reference implementation of components for DLSS
* [Header](header/)
* [Links](links/)
* [Selected Item](selected_item/)
* [Selected Facet](selected_facet/)
* [Toast](toast/)
* [Facet list](facets/)

Expand Down
100 changes: 100 additions & 0 deletions selected_facet/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<html>
<head>
<link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH"
crossorigin="anonymous"
/>
<link href="../styles/sul.css" rel="stylesheet" />
<style>
/* provided by Blacklight */
.applied-filter .filter-name::after {
color: #adb5bd;
content: "❯";
font-size: 90%;
padding-left: 0.3em;
}

.applied-filter .constraint-value {
cursor: default;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}

body {
background: repeating-conic-gradient(#eee 0% 25%, transparent 0% 50%)
50% / 20px 20px;
}
</style>
</head>
<body class="p-4">
<h1>Selected Facet</h1>
<span
class="btn-group applied-filter constraint filter filter-subject_ssim"
>
<span class="constraint-value btn btn-outline-secondary">
<span class="filter-name">Topic</span>
<span class="filter-value" title="Theater">Theater</span>
</span>
<a
class="btn btn-outline-secondary remove"
href="http://localhost:3000/?f%5Blanguage_ssim%5D%5B%5D=Japanese"
>
<span class="blacklight-icons blacklight-icons-remove"
><svg
xmlns="http://www.w3.org/2000/svg"
width="16"
height="16"
fill="currentColor"
class="bi bi-x fs-4"
viewBox="0 0 16 16"
>
<path
d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708"
></path>
</svg>
</span>
<span class="sr-only visually-hidden"
>Remove constraint Topic: Theater</span
>
</a></span
>

<h2 class="mt-5">Selected Facet HTML</h2>
<p>This is the default markup from Blacklight 5.3.</p>
<pre><code class="d-block" style="white-space: pre-wrap; background-color: lightgray;">
&lt;span
class=&quot;btn-group applied-filter constraint filter filter-subject_ssim&quot;
&gt;
&lt;span class=&quot;constraint-value btn btn-outline-secondary&quot;&gt;
&lt;span class=&quot;filter-name&quot;&gt;Topic&lt;/span&gt;
&lt;span class=&quot;filter-value&quot; title=&quot;Theater&quot;&gt;Theater&lt;/span&gt;
&lt;/span&gt;
&lt;a
class=&quot;btn btn-outline-secondary remove&quot;
href=&quot;http://localhost:3000/?f%5Blanguage_ssim%5D%5B%5D=Japanese&quot;
&gt;
&lt;span class=&quot;blacklight-icons blacklight-icons-remove&quot;
&gt;&lt;svg
xmlns=&quot;http://www.w3.org/2000/svg&quot;
width=&quot;16&quot;
height=&quot;16&quot;
fill=&quot;currentColor&quot;
class=&quot;bi bi-x fs-4&quot;
viewBox=&quot;0 0 16 16&quot;
&gt;
&lt;path
d=&quot;M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708&quot;
&gt;&lt;/path&gt;
&lt;/svg&gt;
&lt;/span&gt;
&lt;span class=&quot;sr-only visually-hidden&quot;
&gt;Remove constraint Topic: Theater&lt;/span
&gt;
&lt;/a&gt;&lt;/span
&gt;
</code></pre>
</body>
</html>
3 changes: 2 additions & 1 deletion styles/button.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
--bs-btn-disabled-color: var(--stanford-80-black);
--bs-btn-disabled-bg: var(--stanford-10-black);
--bs-btn-disabled-border-color: var(--stanford-30-black);
--btn-hover-decoration: var(--bs-link-hover-decoration);
--bs-btn-disabled-opacity: 1;
}

.btn:hover {
text-decoration: underline;
text-decoration: var(--btn-hover-decoration);
}

.btn-primary {
Expand Down
30 changes: 30 additions & 0 deletions styles/selected-item.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* A selected-item is for a multiple select form element */
.selected-item {
--bs-badge-color: black;
--bs-badge-font-size: var(--bs-body-font-size);
Expand Down Expand Up @@ -29,3 +30,32 @@
}
}
}

/* An applied-filter is for a selected blacklight facet */
.applied-filter {
--bs-border-radius: 99px;

.constraint-value {
--bs-btn-hover-color: var(--stanford-black);
--btn-hover-decoration: none;

padding-right: 0.25rem; /* Keeping the default left padding */
}

.remove {
--bs-btn-hover-color: var(--stanford-digital-red);
}

.constraint-value,
.remove {
/* overriding .btn-outline-secondary, which is in the default Blacklight markup */
--bs-btn-border-color: var(--stanford-fog-light);
--bs-btn-color: var(--stanford-black);
--bs-btn-bg: var(--stanford-fog-light);
--bs-btn-hover-bg: var(--stanford-fog-light);
--bs-btn-hover-border-color: var(--stanford-fog-light);
--bs-btn-active-border-color: var(--stanford-fog-light);
--bs-btn-active-color: var(--stanford-black);
--bs-btn-padding-y: 0.25rem;
}
}