Grid Class Composition

πŸ‘¨β€πŸ’Ό Use the new logo coordinates to place the logos in the correct grid cells.

CSS Grid cell positioning

πŸ’° You can define what grid column or row an element should be positioned in with the πŸ“œ grid-column-start and πŸ“œ grid-row-start CSS properties respectively.
πŸ’° Tailwind has utilities for πŸ“œ col-start-* and πŸ“œ row-start-*

Tailwind "on demand" classes and dynamic styles

The Tailwind Just-in-Time engine, which generates CSS as you need it, πŸ“œ expects to see entire class strings in your template files.
This means you unfortunately cannot use dynamic classes like this:
<div className={`col-start-${logo.column}`}></div>
As nice as it would be, the JIT engine won't recognise this, and as a result, no CSS will be generated.

Styles lookup directories

πŸ§β€β™€οΈ I've scaffolded out some "lookup" objects we'll use to map Tailwind Grid column and row classes in a way that plays nice with Tailwind's JIT engine:
const columnClasses: Record<(typeof logos)[number]['column'], string> = {}
const rowClasses: Record<(typeof logos)[number]['row'], string> = {}
🦺 The two TypeScript 'Records' you see above ensure that the lookup objects have keys that match the possible values of the 'column' and 'row' properties on the 'logos' array.

Populating the lookup objects

🐨 Add the required keys to the columnClasses object to satisfy the type checker.
🐨 Add the required keys to the rowClasses object to satisfy the type checker.
🐨 Map Tailwind classes to each possible logo.column and logo.row scenario.
πŸ’° Remember the col-start-* and row-start-* utilities I mentioned above? Yeah, these will work great here.

Composing class strings together

πŸ§β€β™€οΈ I've also created this "mini clsx" helper function that lets you combine multiple class strings together:
function clsx(...classes: string[]) {
	return classes.filter(Boolean).join(' ')
}
πŸ§β€β™€οΈ Here's an example of how to use it:
<div className={clsx('some classes', 'more classnames', 'combined together')} />
🐨 Compose the dynamic column class and row class on the li element, using the clsx() helper function.