Skip to content

Commit

Permalink
add leading padding
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Dec 10, 2019
1 parent 4158c0f commit 4fb403d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
10 changes: 8 additions & 2 deletions docs/src/pages/components/autocomplete/Virtualize.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ import { Typography } from '@material-ui/core';

function renderRow(props) {
const { data, index, style } = props;
return React.cloneElement(data[index], { style });
return React.cloneElement(data[index], {
style: {
...style,
top: style.top + 8,
},
});
}

// Adapter for react-window
Expand Down Expand Up @@ -45,8 +50,9 @@ const ListboxComponent = React.forwardRef(function ListboxComponent(props, ref)
<div ref={ref}>
<VariableSizeList
itemData={itemData}
height={getHeight()}
height={getHeight() + 16}
width="100%"
key={itemCount}
outerElementType={outerElementType}
innerElementType="ul"
itemSize={index => getChildSize(itemData[index])}
Expand Down
10 changes: 8 additions & 2 deletions docs/src/pages/components/autocomplete/Virtualize.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ import { Typography } from '@material-ui/core';

function renderRow(props: ListChildComponentProps) {
const { data, index, style } = props;
return React.cloneElement(data[index], { style });
return React.cloneElement(data[index], {
style: {
...style,
top: (style.top as number) + 8,
},
});
}

// Adapter for react-window
Expand Down Expand Up @@ -46,8 +51,9 @@ const ListboxComponent = React.forwardRef<HTMLDivElement>(function ListboxCompon
<div ref={ref}>
<VariableSizeList
itemData={itemData}
height={getHeight()}
height={getHeight() + 16}
width="100%"
key={itemCount}
outerElementType={outerElementType}
innerElementType="ul"
itemSize={index => getChildSize(itemData[index])}
Expand Down

0 comments on commit 4fb403d

Please sign in to comment.