File tree Expand file tree Collapse file tree 3 files changed +6
-25
lines changed Expand file tree Collapse file tree 3 files changed +6
-25
lines changed Original file line number Diff line number Diff line change @@ -44,16 +44,13 @@ describe('IonHeaderParallax', () => {
4444
4545 it ( 'should render correctly' , ( ) => {
4646 const Component = ( ) => {
47- useIonHeaderParallax ( { } )
47+ useIonHeaderParallax ( { image : 'https://picsum.photos/1080' } )
4848 return Element
4949 }
50-
5150 const { container } = render ( < Component /> )
5251 expect ( container ) . toBeTruthy ( )
5352 } )
5453
55-
56-
5754 // Running all pending timers and switching to real timers using Jest
5855 afterEach ( ( ) => {
5956 jest . runOnlyPendingTimers ( )
Original file line number Diff line number Diff line change 11import * as React from 'react'
22
33export type UseIonHeaderParallaxInput = {
4- image ? : string
4+ image : string
55 expandedColor ?: string
66 titleColor ?: string
77 maximumHeight ?: number
@@ -10,8 +10,8 @@ export type UseIonHeaderParallaxInput = {
1010export type UseIonHeaderParallaxResult = void
1111
1212export function useIonHeaderParallax ( {
13+ image,
1314 titleColor = '#AAA' ,
14- image = 'https://picsum.photos/1080' ,
1515 expandedColor = '#313131' ,
1616 maximumHeight = 300 ,
1717} : UseIonHeaderParallaxInput ) : UseIonHeaderParallaxResult {
@@ -67,7 +67,6 @@ export function useIonHeaderParallax({
6767
6868 if ( overlayTitle ) {
6969 overlayTitle . classList . add ( 'parallax-title' )
70-
7170 setTimeout ( ( ) => {
7271 if ( overlayTitle . shadowRoot ) {
7372 const toolbarTitle = overlayTitle . shadowRoot . querySelector ( '.toolbar-title' ) as HTMLElement
@@ -101,11 +100,9 @@ export function useIonHeaderParallax({
101100 }
102101
103102 let originalToolbarBgColor = 'white'
104-
105103 originalToolbarBgColor = window . getComputedStyle ( toolbarBackground as Element , null ) . backgroundColor
106104
107105
108-
109106 // header and title
110107 header . style . position = 'relative'
111108
Original file line number Diff line number Diff line change 11export type UseIonHeaderParallaxInput = {
2- image : string
3- expandedColor : string
4- titleColor : string
5- maximumHeight ?: number
6- }
7-
8- export type UseIonHeaderParallaxResult = {
9- ref : React . MutableRefObject < HTMLElement | null >
10- onScroll : ( ) => void
11- }
12-
13- export type IonHeaderParallaxProps = {
142 image : string
153 expandedColor ?: string
16- originalToolbarBgColor : string
17- maximumHeight : number
18- headerMinHeight : number
4+ titleColor ?: string
5+ maximumHeight ?: number
196}
207
21- export const IonHeaderParallax : React . FC < React . PropsWithChildren < IonHeaderParallaxProps > >
8+ export type UseIonHeaderParallaxResult = void
229
2310export function useIonHeaderParallax ( input : UseIonHeaderParallaxInput ) : UseIonHeaderParallaxResult
You can’t perform that action at this time.
0 commit comments