Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 3 additions & 1 deletion src/responsive-grid/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ export const ResponsiveGrid: React.FC<ResponsiveGridProps> = ({
keyExtractor = (_, index) => String(index), // default to item index if no keyExtractor is provided
HeaderComponent = null,
FooterComponent = null,
direction = 'ltr',
}) => {
const start = direction === 'ltr' ? 'left' : 'right';
const [visibleItems, setVisibleItems] = useState<TileItem[]>([]);

const [containerSize, setContainerSize] = useState({ width: 0, height: 0 });
Expand Down Expand Up @@ -158,7 +160,7 @@ export const ResponsiveGrid: React.FC<ResponsiveGridProps> = ({
{
position: 'absolute',
top: item.top,
left: item.left,
[start]: item.left,
width: item.width,
height: item.height,
},
Expand Down
2 changes: 2 additions & 0 deletions src/responsive-grid/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ export interface ResponsiveGridProps {
| React.ReactElement<any, string | React.JSXElementConstructor<any>>
| null
| undefined;

direction?: 'rtl' | 'ltr';
}

export interface TileItem {
Expand Down
Loading