Search bar pinned again, now flush under the header at every width (sticky offset follows the header's real height); v2.25.2
Publish Container / build (push) Successful in 15m47s
Publish Container / build (push) Successful in 15m47s
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5801af9dfb
commit
9268514219
4 files changed
+20
-5
No files matched your search
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "siteforge",
|
"name": "siteforge",
|
||||||
"version": "2.25.1",
|
"version": "2.25.2",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "siteforge",
|
"name": "siteforge",
|
||||||
"version": "2.25.1",
|
"version": "2.25.2",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-sdk/client-s3": "^3.1135.0",
|
"@aws-sdk/client-s3": "^3.1135.0",
|
||||||
"@dnd-kit/core": "^6.3.1",
|
"@dnd-kit/core": "^6.3.1",
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "siteforge",
|
"name": "siteforge",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "2.25.1",
|
"version": "2.25.2",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
+4
-1
@@ -34,7 +34,10 @@
|
|||||||
.site-search-bar {
|
.site-search-bar {
|
||||||
background: #13120d;
|
background: #13120d;
|
||||||
border-bottom: 1px solid #28241a;
|
border-bottom: 1px solid #28241a;
|
||||||
/* Scrolls away with the page; only the header stays pinned */
|
position: sticky;
|
||||||
|
/* --site-header-h is set from the header's real height (see SiteHeader), so the bar sits flush below it */
|
||||||
|
top: var(--site-header-h, 72px);
|
||||||
|
z-index: 99;
|
||||||
}
|
}
|
||||||
.site-search-bar-inner {
|
.site-search-bar-inner {
|
||||||
max-width: 900px;
|
max-width: 900px;
|
||||||
|
|||||||
+13
-1
@@ -419,11 +419,23 @@ function SiteHeader({ content }: { content: SiteContent }) {
|
|||||||
const [studiesOpen, setStudiesOpen] = useState(false)
|
const [studiesOpen, setStudiesOpen] = useState(false)
|
||||||
const dropdownRef = useRef<HTMLDivElement>(null)
|
const dropdownRef = useRef<HTMLDivElement>(null)
|
||||||
const studiesDropdownRef = useRef<HTMLDivElement>(null)
|
const studiesDropdownRef = useRef<HTMLDivElement>(null)
|
||||||
|
const headerRef = useRef<HTMLElement>(null)
|
||||||
const spotifyUrl = content.platformSpotifyUrl || '/spotify'
|
const spotifyUrl = content.platformSpotifyUrl || '/spotify'
|
||||||
const location = useLocation()
|
const location = useLocation()
|
||||||
const episodesActive = location.pathname.startsWith('/episodes') || location.pathname.startsWith('/finished') || location.pathname.startsWith('/nuggets')
|
const episodesActive = location.pathname.startsWith('/episodes') || location.pathname.startsWith('/finished') || location.pathname.startsWith('/nuggets')
|
||||||
const studiesActive = location.pathname.startsWith('/study') || location.pathname === '/scripture'
|
const studiesActive = location.pathname.startsWith('/study') || location.pathname === '/scripture'
|
||||||
|
|
||||||
|
// The pinned search bar sits just under the header, whatever height the header is at this screen size
|
||||||
|
useEffect(() => {
|
||||||
|
const header = headerRef.current
|
||||||
|
if (!header) return
|
||||||
|
const update = () => document.documentElement.style.setProperty('--site-header-h', `${header.getBoundingClientRect().height}px`)
|
||||||
|
update()
|
||||||
|
const observer = new ResizeObserver(update)
|
||||||
|
observer.observe(header)
|
||||||
|
return () => observer.disconnect()
|
||||||
|
}, [])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
function handleOutsideClick(e: MouseEvent) {
|
function handleOutsideClick(e: MouseEvent) {
|
||||||
if (dropdownRef.current && !dropdownRef.current.contains(e.target as Node)) {
|
if (dropdownRef.current && !dropdownRef.current.contains(e.target as Node)) {
|
||||||
@@ -438,7 +450,7 @@ function SiteHeader({ content }: { content: SiteContent }) {
|
|||||||
}, [episodesOpen, studiesOpen])
|
}, [episodesOpen, studiesOpen])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<header className="site-header">
|
<header className="site-header" ref={headerRef}>
|
||||||
<div className="header-inner">
|
<div className="header-inner">
|
||||||
<Link to="/" className="header-logo" aria-label="Home">
|
<Link to="/" className="header-logo" aria-label="Home">
|
||||||
<img src="/book_icon.png" alt="" className="header-logo-img" />
|
<img src="/book_icon.png" alt="" className="header-logo-img" />
|
||||||
|
|||||||
Reference in new issue
Block a user