Skip to content

Commit 21059f0

Browse files
author
Daihyxsk (Dx)
committed
fix: improve search modal UI and fix input icon overlap
Restyle search popup with header bar, open/close animation, better result cards, accessible dialog role, mobile layout. Fix search input padding so text no longer overlaps the magnifying glass icon.
1 parent 4eb3550 commit 21059f0

File tree

2 files changed

+217
-23
lines changed

2 files changed

+217
-23
lines changed

src/_includes/layouts/base.njk

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,15 @@
7979
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg>
8080
</button>
8181
<div class="search-overlay" id="search-overlay">
82-
<div class="search-modal">
83-
<button class="search-close" id="search-close" aria-label="{% if lang == 'fr' %}Fermer{% else %}Close{% endif %}">&times;</button>
82+
<div class="search-modal" role="dialog" aria-modal="true" aria-label="{% if lang == 'fr' %}Recherche{% else %}Search{% endif %}">
83+
<div class="search-modal-header">
84+
<span class="search-modal-title">
85+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg>
86+
{% if lang == 'fr' %}Recherche{% else %}Search{% endif %}
87+
<kbd class="search-kbd">Ctrl+K</kbd>
88+
</span>
89+
<button class="search-close" id="search-close" aria-label="{% if lang == 'fr' %}Fermer{% else %}Close{% endif %}">&times;</button>
90+
</div>
8491
<div id="search-container"></div>
8592
</div>
8693
</div>

src/assets/css/style.css

Lines changed: 208 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1592,6 +1592,7 @@ tbody tr:hover {
15921592
Search FAB + Modal (Pagefind)
15931593
============================================================ */
15941594

1595+
/* --- FAB button --- */
15951596
.search-fab {
15961597
position: fixed;
15971598
bottom: 1.5rem;
@@ -1617,98 +1618,284 @@ tbody tr:hover {
16171618
background: var(--color-brown-medium);
16181619
}
16191620

1621+
/* --- Overlay --- */
16201622
.search-overlay {
1621-
display: none;
16221623
position: fixed;
16231624
inset: 0;
16241625
z-index: 1000;
1625-
background: rgba(0,0,0,0.6);
1626+
background: rgba(0,0,0,0.55);
16261627
backdrop-filter: blur(4px);
1628+
display: flex;
16271629
align-items: flex-start;
16281630
justify-content: center;
1629-
padding-top: 10vh;
1631+
padding-top: 8vh;
1632+
opacity: 0;
1633+
visibility: hidden;
1634+
transition: opacity 0.25s, visibility 0.25s;
16301635
}
16311636

16321637
.search-overlay.active {
1633-
display: flex;
1638+
opacity: 1;
1639+
visibility: visible;
16341640
}
16351641

1642+
/* --- Modal --- */
16361643
.search-modal {
16371644
position: relative;
1638-
width: 90%;
1639-
max-width: 640px;
1640-
max-height: 75vh;
1645+
width: 92%;
1646+
max-width: 660px;
1647+
max-height: 78vh;
16411648
background: var(--color-parchment);
16421649
border: 2px solid var(--color-gold);
16431650
border-radius: 12px;
1644-
box-shadow: 0 12px 48px rgba(0,0,0,0.4);
1645-
overflow-y: auto;
1646-
padding: 1.5rem;
1651+
box-shadow: 0 16px 64px rgba(0,0,0,0.45);
1652+
display: flex;
1653+
flex-direction: column;
1654+
transform: translateY(-12px) scale(0.97);
1655+
transition: transform 0.25s;
1656+
}
1657+
1658+
.search-overlay.active .search-modal {
1659+
transform: translateY(0) scale(1);
1660+
}
1661+
1662+
/* --- Header bar --- */
1663+
.search-modal-header {
1664+
display: flex;
1665+
align-items: center;
1666+
justify-content: space-between;
1667+
padding: 0.9rem 1.2rem 0.6rem;
1668+
border-bottom: 1px solid var(--color-parchment-darker);
1669+
}
1670+
1671+
.search-modal-title {
1672+
font-family: var(--font-heading, inherit);
1673+
font-size: 1rem;
1674+
font-weight: 700;
1675+
color: var(--color-brown-dark);
1676+
margin: 0;
1677+
display: flex;
1678+
align-items: center;
1679+
gap: 0.5rem;
1680+
}
1681+
1682+
.search-modal-title svg {
1683+
opacity: 0.6;
1684+
}
1685+
1686+
.search-kbd {
1687+
font-size: 0.7rem;
1688+
font-family: inherit;
1689+
background: var(--color-parchment-dark);
1690+
color: var(--color-brown-medium);
1691+
border: 1px solid var(--color-parchment-darker);
1692+
border-radius: 4px;
1693+
padding: 0.15rem 0.45rem;
1694+
margin-left: 0.3rem;
16471695
}
16481696

16491697
.search-close {
1650-
position: absolute;
1651-
top: 0.5rem;
1652-
right: 0.75rem;
16531698
background: none;
16541699
border: none;
1655-
font-size: 1.8rem;
1700+
width: 32px;
1701+
height: 32px;
1702+
border-radius: 6px;
1703+
display: flex;
1704+
align-items: center;
1705+
justify-content: center;
1706+
font-size: 1.4rem;
16561707
color: var(--color-brown-medium);
16571708
cursor: pointer;
1709+
transition: background 0.15s, color 0.15s;
16581710
line-height: 1;
16591711
}
16601712

16611713
.search-close:hover {
1714+
background: var(--color-parchment-dark);
16621715
color: var(--color-brown-dark);
16631716
}
16641717

1665-
/* Pagefind UI overrides to match parchment theme */
1718+
/* --- Search container (results area) --- */
1719+
#search-container {
1720+
padding: 1rem 1.2rem 1.2rem;
1721+
overflow-y: auto;
1722+
flex: 1;
1723+
min-height: 0;
1724+
}
1725+
1726+
/* --- Pagefind UI overrides --- */
1727+
1728+
/* Form wrapper */
1729+
.pagefind-ui__form {
1730+
position: relative;
1731+
}
1732+
1733+
/* Search input */
16661734
.pagefind-ui__search-input {
1735+
width: 100% !important;
16671736
background: var(--color-parchment-light) !important;
16681737
border: 2px solid var(--color-parchment-darker) !important;
16691738
border-radius: 8px !important;
16701739
color: var(--color-brown-dark) !important;
16711740
font-family: inherit !important;
16721741
font-size: 1rem !important;
1673-
padding: 0.6rem 1rem !important;
1742+
padding: 0.7rem 2.8rem 0.7rem 2.6rem !important;
1743+
transition: border-color 0.2s, box-shadow 0.2s !important;
16741744
}
16751745

16761746
.pagefind-ui__search-input:focus {
16771747
border-color: var(--color-gold) !important;
16781748
outline: none !important;
1679-
box-shadow: 0 0 0 3px rgba(200,169,81,0.3) !important;
1749+
box-shadow: 0 0 0 3px rgba(200,169,81,0.25) !important;
1750+
}
1751+
1752+
.pagefind-ui__search-input::placeholder {
1753+
color: var(--color-brown-medium) !important;
1754+
opacity: 0.6 !important;
1755+
}
1756+
1757+
/* Clear button */
1758+
.pagefind-ui__search-clear {
1759+
background: none !important;
1760+
border: none !important;
1761+
color: var(--color-brown-medium) !important;
1762+
font-size: 0.8rem !important;
1763+
cursor: pointer !important;
1764+
padding: 0.3rem 0.5rem !important;
1765+
border-radius: 4px !important;
1766+
transition: background 0.15s, color 0.15s !important;
1767+
}
1768+
1769+
.pagefind-ui__search-clear:hover {
1770+
background: var(--color-parchment-dark) !important;
1771+
color: var(--color-brown-dark) !important;
1772+
}
1773+
1774+
/* Message (result count) */
1775+
.pagefind-ui__message {
1776+
font-size: 0.85rem !important;
1777+
color: var(--color-brown-medium) !important;
1778+
padding: 0.6rem 0 0.3rem !important;
1779+
margin: 0 !important;
1780+
border-bottom: 1px solid var(--color-parchment-darker) !important;
1781+
}
1782+
1783+
/* Results list */
1784+
.pagefind-ui__results {
1785+
padding: 0 !important;
1786+
margin: 0 !important;
1787+
list-style: none !important;
1788+
}
1789+
1790+
/* Individual result */
1791+
.pagefind-ui__result {
1792+
padding: 0.8rem 0.6rem !important;
1793+
margin: 0 !important;
1794+
border-bottom: 1px solid var(--color-parchment-dark) !important;
1795+
border-radius: 0 !important;
1796+
transition: background 0.15s !important;
1797+
}
1798+
1799+
.pagefind-ui__result:last-child {
1800+
border-bottom: none !important;
1801+
}
1802+
1803+
.pagefind-ui__result:hover {
1804+
background: var(--color-parchment-light) !important;
1805+
}
1806+
1807+
/* Result title */
1808+
.pagefind-ui__result-title {
1809+
margin-bottom: 0.25rem !important;
16801810
}
16811811

16821812
.pagefind-ui__result-link {
16831813
color: var(--color-brown-dark) !important;
1684-
font-weight: 600 !important;
1814+
font-weight: 700 !important;
1815+
font-size: 1.05rem !important;
1816+
text-decoration: none !important;
1817+
transition: color 0.15s !important;
16851818
}
16861819

16871820
.pagefind-ui__result-link:hover {
16881821
color: var(--color-gold-dark) !important;
1822+
text-decoration: underline !important;
16891823
}
16901824

1825+
/* Result excerpt */
16911826
.pagefind-ui__result-excerpt {
16921827
color: var(--color-brown-medium) !important;
1828+
font-size: 0.88rem !important;
1829+
line-height: 1.5 !important;
1830+
margin-top: 0.2rem !important;
16931831
}
16941832

1833+
/* Highlight in results */
16951834
mark.pagefind-ui__result-highlight {
16961835
background: var(--color-gold-light) !important;
16971836
color: var(--color-brown-dark) !important;
1698-
border-radius: 2px;
1699-
padding: 0 2px;
1837+
border-radius: 2px !important;
1838+
padding: 0.05rem 0.2rem !important;
1839+
font-weight: 600 !important;
1840+
}
1841+
1842+
/* Sub-results (nested) */
1843+
.pagefind-ui__result-nested {
1844+
padding-left: 0.6rem !important;
1845+
border-left: 2px solid var(--color-parchment-darker) !important;
1846+
margin-top: 0.4rem !important;
17001847
}
17011848

1849+
/* "Load more" button */
17021850
.pagefind-ui__button {
1851+
display: block !important;
1852+
width: 100% !important;
1853+
margin-top: 0.8rem !important;
1854+
padding: 0.6rem 1rem !important;
17031855
background: var(--color-brown-dark) !important;
17041856
color: var(--color-gold-light) !important;
1705-
border-radius: 6px !important;
1857+
border: none !important;
1858+
border-radius: 8px !important;
1859+
font-family: inherit !important;
1860+
font-size: 0.9rem !important;
1861+
font-weight: 600 !important;
1862+
cursor: pointer !important;
1863+
transition: background 0.15s !important;
17061864
}
17071865

17081866
.pagefind-ui__button:hover {
17091867
background: var(--color-brown-medium) !important;
17101868
}
17111869

1870+
/* Hide image thumbnails */
1871+
.pagefind-ui__result-thumb {
1872+
display: none !important;
1873+
}
1874+
1875+
/* Loading state */
1876+
.pagefind-ui__loading {
1877+
color: var(--color-brown-medium) !important;
1878+
text-align: center !important;
1879+
padding: 2rem 0 !important;
1880+
}
1881+
17121882
@media print {
17131883
.search-fab, .search-overlay { display: none !important; }
17141884
}
1885+
1886+
@media (max-width: 480px) {
1887+
.search-modal {
1888+
width: 98%;
1889+
max-height: 90vh;
1890+
border-radius: 10px;
1891+
}
1892+
.search-overlay {
1893+
padding-top: 3vh;
1894+
}
1895+
.search-modal-header {
1896+
padding: 0.7rem 0.9rem 0.5rem;
1897+
}
1898+
#search-container {
1899+
padding: 0.7rem 0.9rem 1rem;
1900+
}
1901+
}

0 commit comments

Comments
 (0)