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.