Skip to content

Commit bc8c0cc

Browse files
committed
fix: package types
1 parent 3a7ff13 commit bc8c0cc

File tree

3 files changed

+6
-25
lines changed

3 files changed

+6
-25
lines changed

src/useIonicHeaderParallax.spec.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff 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()

src/useIonicHeaderParallax.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react'
22

33
export type UseIonHeaderParallaxInput = {
4-
image?: string
4+
image: string
55
expandedColor?: string
66
titleColor?: string
77
maximumHeight?: number
@@ -10,8 +10,8 @@ export type UseIonHeaderParallaxInput = {
1010
export type UseIonHeaderParallaxResult = void
1111

1212
export 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

types/index.d.ts

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,10 @@
11
export 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

2310
export function useIonHeaderParallax(input: UseIonHeaderParallaxInput): UseIonHeaderParallaxResult

0 commit comments

Comments
 (0)