Skip to content

Commit a04c6ee

Browse files
authored
Support RTL in ResponsiveGrid
1 parent 16fde69 commit a04c6ee

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/responsive-grid/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ export const ResponsiveGrid: React.FC<ResponsiveGridProps> = ({
2626
keyExtractor = (_, index) => String(index), // default to item index if no keyExtractor is provided
2727
HeaderComponent = null,
2828
FooterComponent = null,
29+
direction = 'ltr',
2930
}) => {
31+
const start = direction === 'ltr' ? 'left' : 'right';
3032
const [visibleItems, setVisibleItems] = useState<TileItem[]>([]);
3133

3234
const [containerSize, setContainerSize] = useState({ width: 0, height: 0 });
@@ -158,7 +160,7 @@ export const ResponsiveGrid: React.FC<ResponsiveGridProps> = ({
158160
{
159161
position: 'absolute',
160162
top: item.top,
161-
left: item.left,
163+
[start]: item.left,
162164
width: item.width,
163165
height: item.height,
164166
},

0 commit comments

Comments
 (0)