Skip to content

Commit b5c9fbc

Browse files
Tidy up filters on loci page (#250)
## Description Tidy up filters on loci page above table. Before/after: <img width="300" alt="Screenshot 2025-08-11 at 12 30 56 PM" src="https://github.com/user-attachments/assets/935a19ee-b435-4246-944d-8a206264474c" /> <img width="300" alt="Screenshot 2025-08-11 at 12 31 23 PM" src="https://github.com/user-attachments/assets/da42eac9-9888-4dac-8fc1-0bc3eea02dc9" /> ## Major Changes ## Minor Changes - Compactify layout of filters above table on loci page. - Change tag colors to be more distinctive. - Fix and simplify tooltip CSS. ## Checklist - [x] All changes are well summarized - [x] Check all tests pass - [x] Check that the website preview looks good - [x] Update the STRchive version in `CITATION.cff`, format X.Y.Z. If any major changes, increment Y. If only minor changes, increment Z. If the breaking change (rare), increment X. - [x] Ask someone to review this PR
1 parent 0086f2a commit b5c9fbc

5 files changed

Lines changed: 72 additions & 61 deletions

File tree

site/src/components/Tooltips.astro

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
<script>
66
import tippy from "tippy.js";
7-
import "tippy.js/dist/tippy.css";
87

98
/** add tooltips to any element with data-tooltip attribute */
109

@@ -64,3 +63,31 @@
6463

6564
window.addEventListener("load", init);
6665
</script>
66+
67+
<style is:global>
68+
.tippy-box {
69+
max-width: 350px;
70+
padding: 10px 15px;
71+
border-radius: var(--rounded);
72+
background: var(--dark-gray);
73+
color: var(--white);
74+
}
75+
76+
.tippy-arrow {
77+
z-index: -1;
78+
}
79+
80+
.tippy-arrow::after {
81+
display: block;
82+
width: 10px;
83+
height: 10px;
84+
translate: 0 50%;
85+
rotate: 45deg;
86+
background: var(--dark-gray);
87+
content: "";
88+
}
89+
90+
[data-placement="bottom"] .tippy-arrow {
91+
bottom: 100%;
92+
}
93+
</style>

site/src/data/tags.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
import { BsStars } from "react-icons/bs";
2-
import { FaCircleExclamation, FaCircleQuestion, FaCircleStop, FaCircleCheck, FaHourglassStart } from "react-icons/fa6";
2+
import {
3+
FaCircleCheck,
4+
FaCircleExclamation,
5+
FaCircleQuestion,
6+
FaCircleStop,
7+
FaHourglassStart,
8+
} from "react-icons/fa6";
39
import { newThreshold } from "./derived";
410

11+
/** https://tailwindcss.com/docs/colors */
12+
513
/** top-level tag types */
614
export const tagOptions = [
715
/** "important" tags */
@@ -10,38 +18,39 @@ export const tagOptions = [
1018
label: "New",
1119
tooltip: `Less than ~${newThreshold} years old`,
1220
Icon: BsStars,
13-
color: `var(--primary)`,
21+
color: "#0ea5e9",
1422
important: true,
1523
},
1624
{
1725
value: "contradictory_evidence",
1826
label: "Contradictory",
1927
tooltip: "Evidence either disputes or refutes gene-disease relationship",
2028
Icon: FaCircleExclamation,
21-
color: "var(--secondary)",
29+
color: "#ef4444",
2230
important: true,
2331
},
2432
{
2533
value: "limited_evidence",
2634
label: "Limited",
2735
tooltip: "There is limited evidence for this locus-disease relationship",
2836
Icon: FaCircleQuestion,
29-
color: `var(--tertiary)`,
37+
color: "#f59e0b",
3038
important: true,
3139
},
3240
{
3341
value: "supported_evidence",
3442
label: "Supported",
3543
tooltip: "There is compelling evidence for this locus-disease relationship",
3644
Icon: FaCircleCheck,
37-
color: "var(--primary)",
45+
color: "#10b981",
3846
important: true,
3947
},
4048
{
4149
value: "unknown_evidence",
4250
label: "Not Evaluated",
4351
tooltip: "This locus-disease relationship has not yet been evaluated",
4452
Icon: FaHourglassStart,
53+
color: "#64748b",
4554
important: true,
4655
},
4756

site/src/layouts/global.css

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -349,24 +349,6 @@ dd:empty::after {
349349
gap: 40px;
350350
}
351351

352-
.tippy-box {
353-
max-width: 350px;
354-
padding: 10px 15px;
355-
border-radius: var(--rounded);
356-
background: var(--dark-gray);
357-
color: var(--white);
358-
font-size: 1rem;
359-
}
360-
361-
.tippy-arrow {
362-
z-index: 1;
363-
color: var(--dark-gray);
364-
}
365-
366-
.tippy-content {
367-
padding: 0;
368-
}
369-
370352
::-webkit-scrollbar {
371353
width: 7px;
372354
height: 7px;

site/src/loci/Table.jsx

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,7 @@ const Table = ({ loci }) => {
187187
return (
188188
<div className="col">
189189
{/* filters */}
190-
<div className={clsx("row", classes.filters)}>
191-
<TextBox placeholder="Search" value={search} onChange={setSearch} />
190+
<div className="row">
192191
<div className="row">
193192
{importantTagOptions.map(({ Icon, label, color, tooltip }, index) => (
194193
<CheckBox
@@ -209,39 +208,43 @@ const Table = ({ loci }) => {
209208
/>
210209
))}
211210
</div>
212-
<NumberBox
213-
label="Motif max"
214-
value={motif}
215-
onChange={setMotif}
216-
min={1}
217-
max={maxMotif}
218-
/>
219-
<div>
211+
212+
<div className="row">
213+
<TextBox placeholder="Search" value={search} onChange={setSearch} />
214+
215+
<NumberBox
216+
label="Motif max"
217+
value={motif}
218+
onChange={setMotif}
219+
min={1}
220+
max={maxMotif}
221+
/>
222+
220223
<Select
221224
label="Inheritance"
222225
value={inheritance}
223226
onChange={setInheritance}
224227
options={inheritanceOptions}
225228
/>
226229
</div>
227-
</div>
228230

229-
{/* row count */}
230-
<div className="row">
231-
<strong>{filteredLoci.length.toLocaleString()} loci</strong>
232-
<Button
233-
design="plain"
234-
onClick={() =>
235-
/** download filtered loci */
236-
downloadJson(filteredLoci, [
237-
filteredLoci.length < derivedLoci.length ? "filtered" : "",
238-
"loci",
239-
])
240-
}
241-
data-tooltip="Download filtered loci"
242-
>
243-
Download <LuDownload />
244-
</Button>
231+
{/* row count */}
232+
<div className="row">
233+
<strong>{filteredLoci.length.toLocaleString()} loci</strong>
234+
<Button
235+
design="plain"
236+
onClick={() =>
237+
/** download filtered loci */
238+
downloadJson(filteredLoci, [
239+
filteredLoci.length < derivedLoci.length ? "filtered" : "",
240+
"loci",
241+
])
242+
}
243+
data-tooltip="Download filtered loci"
244+
>
245+
Download <LuDownload />
246+
</Button>
247+
</div>
245248
</div>
246249

247250
{/* table */}

site/src/loci/Table.module.css

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
.filters {
2-
justify-content: space-between;
3-
}
4-
5-
@media (max-width: 600px) {
6-
.filters {
7-
flex-direction: column;
8-
}
9-
}
10-
111
.tags-cell {
122
gap: 5px;
133
}

0 commit comments

Comments
 (0)