Could you assist me in implementing a grid layout that fulfills these specific criteria? I'm unsure of how to proceed, so any guidance would be greatly appreciated.
https://i.sstatic.net/vBtXc.png
When there are more than 9 items, the current layout changes the order from top to bottom. Is there a solution to maintain the desired item placement?
private getKeysStyle(items: string) {
if(items.length >= 9){
return {
marginTop: '8px',
display: 'grid',
gridGap: '6px',
gridAutoFlow: 'column',
gridTemplateColumns: 'repeat(auto-fill, minmax(40px,1fr))',
gridTemplateRows: 'repeat(4, 1fr)',
};
}
return {
marginTop: '8px',
display: 'grid',
gridGap: '6px',
gridTemplateColumns: 'repeat(2, 1fr)',
}
}
The current sorting order is not meeting the requirement. I need to adjust the order accordingly.