property-practice-ui 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -231,7 +231,7 @@ export const SideNav = ({
|
|
|
231
231
|
const isActive = activeItem === item.href;
|
|
232
232
|
return (
|
|
233
233
|
<NavItem key={item.href}>
|
|
234
|
-
<NavLink href={item.href} $isActive={isActive}>
|
|
234
|
+
<NavLink href={item.href} $isActive={isActive} onClick={onClose}>
|
|
235
235
|
{isActive ? <ActiveTriangle triangleColor={triangleColor} /> : <InactiveSpacer />}
|
|
236
236
|
<TextButton
|
|
237
237
|
asChild
|
|
@@ -17,12 +17,13 @@ const CarouselContainer = styled.div`
|
|
|
17
17
|
|
|
18
18
|
const CardsWrapper = styled.div`
|
|
19
19
|
display: flex;
|
|
20
|
+
align-items: stretch;
|
|
20
21
|
gap: 1.5rem;
|
|
21
22
|
padding: 1rem 0;
|
|
22
23
|
|
|
23
24
|
/* Desktop: controlled by JS */
|
|
24
25
|
@media (min-width: 768px) {
|
|
25
|
-
overflow
|
|
26
|
+
overflow: hidden;
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
/* Mobile: native scroll with snap */
|
|
@@ -40,6 +41,7 @@ const CardsWrapper = styled.div`
|
|
|
40
41
|
|
|
41
42
|
const CardContainer = styled.div<{ $translateX: number }>`
|
|
42
43
|
display: flex;
|
|
44
|
+
align-items: stretch;
|
|
43
45
|
gap: 1.5rem;
|
|
44
46
|
|
|
45
47
|
/* Desktop: transform animation */
|
|
@@ -1,16 +1,22 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from 'react';
|
|
1
2
|
import styled from 'styled-components';
|
|
2
3
|
import { ExtendedButton, TextButton } from '../../atoms';
|
|
3
4
|
import { colors } from '../../tokens/colors';
|
|
4
5
|
|
|
5
6
|
type BorderColor = keyof typeof colors.border;
|
|
6
7
|
|
|
7
|
-
const HeaderContainer = styled.header
|
|
8
|
+
const HeaderContainer = styled.header<{ $isVisible: boolean }>`
|
|
8
9
|
display: flex;
|
|
9
10
|
justify-content: space-between;
|
|
10
11
|
align-items: center;
|
|
11
12
|
background-color: #ffffff;
|
|
12
13
|
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
13
14
|
padding: 0 1rem;
|
|
15
|
+
position: sticky;
|
|
16
|
+
top: 0;
|
|
17
|
+
z-index: 100;
|
|
18
|
+
transform: translateY(${props => props.$isVisible ? '0' : '-100%'});
|
|
19
|
+
transition: transform 0.3s ease-in-out;
|
|
14
20
|
`;
|
|
15
21
|
|
|
16
22
|
const LogoWrapper = styled.div`
|
|
@@ -111,8 +117,27 @@ export const Header = ({
|
|
|
111
117
|
secondaryBgVariant = 'transparent',
|
|
112
118
|
secondaryTextVariant = 'brand',
|
|
113
119
|
}: HeaderProps) => {
|
|
120
|
+
const [isVisible, setIsVisible] = useState(true);
|
|
121
|
+
const lastScrollY = useRef(0);
|
|
122
|
+
|
|
123
|
+
useEffect(() => {
|
|
124
|
+
const handleScroll = () => {
|
|
125
|
+
const currentScrollY = window.scrollY;
|
|
126
|
+
|
|
127
|
+
if (currentScrollY < lastScrollY.current) {
|
|
128
|
+
setIsVisible(true);
|
|
129
|
+
} else {
|
|
130
|
+
setIsVisible(false);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
lastScrollY.current = currentScrollY;
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
window.addEventListener('scroll', handleScroll, { passive: true });
|
|
137
|
+
return () => window.removeEventListener('scroll', handleScroll);
|
|
138
|
+
}, []);
|
|
114
139
|
return (
|
|
115
|
-
<HeaderContainer>
|
|
140
|
+
<HeaderContainer $isVisible={isVisible}>
|
|
116
141
|
<LogoWrapper>
|
|
117
142
|
<img src={logo} alt="Logo" />
|
|
118
143
|
</LogoWrapper>
|