Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typescript type errors about containers and remove unnecessary pa… #922

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/grid-gap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const ListContainer = styled.div`
flex-wrap: wrap;
row-gap: 20px;
column-gap: 20px;
` as GridComponents['List']
`

export function Example() {
const ref = React.createRef<VirtuosoGridHandle>()
Expand Down
3 changes: 1 addition & 2 deletions examples/grid-header-footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,12 @@ const ItemWrapper = styled.div`
height: 30px;
padding: 20px;
background: white;
}
`

const ListContainer = styled.div`
display: flex;
flex-wrap: wrap;
` as GridComponents['List']
`

export function Example() {
return (
Expand Down
3 changes: 1 addition & 2 deletions examples/grid-optimize-rendering.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,12 @@ const ItemWrapper = styled.div`
padding: 20px;
box-shadow: 0 5px 6px -6px #777;
background: white;
}
`

const ListContainer = styled.div`
display: flex;
flex-wrap: wrap;
` as GridComponents['List']
`

const Item = React.memo<any>(({ item }: { item: { index: number; selected: boolean } }) => {
return <div style={{ backgroundColor: item.selected ? 'blue' : 'white' }}>Item {item.index}</div>
Expand Down
2 changes: 1 addition & 1 deletion examples/grid-responsive-columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const ListContainer = styled.div`
grid-template-rows: repeat(auto-fill, 100px);
justify-content: space-evenly;
margin: 10px;
` as GridComponents['List']
`

export function Example() {
return (
Expand Down
2 changes: 1 addition & 1 deletion examples/grid-scroll-seek-placeholder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const ItemContainer = styled.div`
const ListContainer = styled.div`
display: flex;
flex-wrap: wrap;
` as GridComponents['List']
`

export function Example() {
return (
Expand Down
3 changes: 1 addition & 2 deletions examples/grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,12 @@ const ItemWrapper = styled.div`
height: 30px;
padding: 20px;
background: white;
}
`

const ListContainer = styled.div`
display: flex;
flex-wrap: wrap;
` as GridComponents['List']
`

export function Example() {
const ref = React.createRef<VirtuosoGridHandle>()
Expand Down
3 changes: 1 addition & 2 deletions examples/scroll-element-grid-scroller.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,11 @@ const ItemWrapper = styled.div`
padding: 20px;
box-shadow: 0 5px 6px -6px #777;
background: white;
}
`
const ListContainer = styled.div`
display: flex;
flex-wrap: wrap;
` as GridComponents['List']
`

export function Example() {
const [customScrollParent, setCustomScrollParent] = React.useState(null)
Expand Down
3 changes: 1 addition & 2 deletions examples/window-grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,12 @@ const ItemWrapper = styled.div`
padding: 20px;
box-shadow: 0 5px 6px -6px #777;
background: white;
}
`

const ListContainer = styled.div`
display: flex;
flex-wrap: wrap;
` as GridComponents['List']
`

export function Example() {
const ref = React.createRef<VirtuosoGridHandle>()
Expand Down
9 changes: 5 additions & 4 deletions src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,27 @@ export type TableProps = Pick<React.ComponentPropsWithRef<'table'>, 'style' | 'c
/**
* Passed to the Components.TableBody custom component
*/
export type TableBodyProps = Pick<React.ComponentPropsWithRef<'tbody'>, 'style' | 'children' | 'ref' | 'className'> & {
export type TableBodyProps = Pick<React.ComponentPropsWithRef<'tbody'>, 'style' | 'children' | 'className'> & {
'data-test-id': string
}

/**
* Passed to the Components.List custom component
*/
export type ListProps = Pick<React.ComponentPropsWithRef<'div'>, 'style' | 'children' | 'ref'> & { 'data-test-id': string }
export type ListProps = Pick<React.ComponentPropsWithRef<'div'>, 'style' | 'children'> & { 'data-test-id': string }

/**
* Passed to the Components.List custom component
*/
export type GridListProps = Pick<React.ComponentPropsWithRef<'div'>, 'style' | 'children' | 'ref' | 'className'> & {
export type GridListProps = Pick<React.ComponentPropsWithRef<'div'>, 'style' | 'children' | 'className'> & {
'data-test-id': string

}

/**
* Passed to the Components.Scroller custom component
*/
export type ScrollerProps = Pick<React.ComponentPropsWithRef<'div'>, 'style' | 'children' | 'tabIndex' | 'ref'> & {
export type ScrollerProps = Pick<React.ComponentPropsWithRef<'div'>, 'style' | 'children' | 'tabIndex'> & {
'data-test-id'?: string
'data-virtuoso-scroller'?: boolean
}
Expand Down