@ecohouse/ui 0.1.55 → 0.1.56

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecohouse/ui",
3
- "version": "0.1.55",
3
+ "version": "0.1.56",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "description": "Cross-platform presentation-only UI components for EcoHouse (React Native + React Native Web)",
@@ -32,6 +32,7 @@ const meta = {
32
32
  imageUrl: "https://i.pravatar.cc/150?img=47",
33
33
  },
34
34
  onLogOut: fn(),
35
+ onLogoPress: fn(),
35
36
  logoAccessibilityLabel: "Cortel Booking",
36
37
  navigationAccessibilityLabel: "Հաշվի նավիգացիա",
37
38
  collapseAccessibilityLabel: "Թաքցնել կողագոտին",
@@ -43,6 +44,7 @@ const meta = {
43
44
  collapsed: { control: "boolean" },
44
45
  defaultCollapsed: { control: "boolean" },
45
46
  onLogOut: { action: "log out" },
47
+ onLogoPress: { action: "logo pressed" },
46
48
  onCollapsedChange: { action: "collapsed change" },
47
49
  },
48
50
  parameters: {
@@ -46,6 +46,8 @@ export interface SidebarProps extends Omit<ViewProps, "style" | "children"> {
46
46
  items: readonly SidebarItem[];
47
47
  user: SidebarUser;
48
48
  onLogOut?: () => void;
49
+ /** Makes the brand mark interactive, e.g. to navigate to the home page. */
50
+ onLogoPress?: () => void;
49
51
  /** Accessible name for the brand mark. Defaults to `"Cortel Booking"`. */
50
52
  logoAccessibilityLabel?: string;
51
53
  /** Accessible name for the nav landmark. Defaults to `"Account navigation"`. */
@@ -84,6 +86,7 @@ export const Sidebar = forwardRef<ComponentRef<typeof View>, SidebarProps>(funct
84
86
  items,
85
87
  user,
86
88
  onLogOut,
89
+ onLogoPress,
87
90
  logoAccessibilityLabel = "Cortel Booking",
88
91
  navigationAccessibilityLabel = "Account navigation",
89
92
  collapseAccessibilityLabel = "Collapse sidebar",
@@ -164,12 +167,28 @@ export const Sidebar = forwardRef<ComponentRef<typeof View>, SidebarProps>(funct
164
167
  accessibilityElementsHidden={collapsed}
165
168
  importantForAccessibility={collapsed ? "no-hide-descendants" : "auto"}
166
169
  >
167
- <BrandLogo
168
- accessibilityLabel={logoAccessibilityLabel}
169
- height={LOGO_HEIGHT}
170
- variant="brand"
171
- width={LOGO_WIDTH}
172
- />
170
+ {onLogoPress ? (
171
+ <Pressable
172
+ accessibilityRole="link"
173
+ accessibilityLabel={logoAccessibilityLabel}
174
+ hitSlop={8}
175
+ onPress={onLogoPress}
176
+ >
177
+ <BrandLogo
178
+ accessibilityLabel={logoAccessibilityLabel}
179
+ height={LOGO_HEIGHT}
180
+ variant="brand"
181
+ width={LOGO_WIDTH}
182
+ />
183
+ </Pressable>
184
+ ) : (
185
+ <BrandLogo
186
+ accessibilityLabel={logoAccessibilityLabel}
187
+ height={LOGO_HEIGHT}
188
+ variant="brand"
189
+ width={LOGO_WIDTH}
190
+ />
191
+ )}
173
192
  </Animated.View>
174
193
 
175
194
  {onClose ? (