Skip to content

Commit 2972644

Browse files
committed
tailwindcss: fix dynamic class names
1 parent 0a72b92 commit 2972644

2 files changed

Lines changed: 15 additions & 16 deletions

File tree

src/components/board/Board.tsx

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,19 @@ export class Board extends React.Component<BoardProps, BoardState> {
138138
this.pickOrder[this.state.currentPickIndex % this.pickOrder.length];
139139
}
140140

141+
const gridCols: Record<number, string> = {
142+
1: "grid-cols-1",
143+
2: "grid-cols-2",
144+
3: "grid-cols-3",
145+
4: "grid-cols-4",
146+
5: "grid-cols-5",
147+
6: "grid-cols-6",
148+
7: "grid-cols-7",
149+
8: "grid-cols-8",
150+
9: "grid-cols-9",
151+
10: "grid-cols-10",
152+
};
153+
141154
return (
142155
<DragDropContext onDragEnd={this.onDragEnd}>
143156
<div className={`dnd-status-${draftStatus}`}>
@@ -161,10 +174,7 @@ export class Board extends React.Component<BoardProps, BoardState> {
161174
)}
162175
</div>
163176
<div>
164-
<div
165-
id="dnd-teams"
166-
className={`grid-cols-${this.config.teamColumns}`}
167-
>
177+
<div id="dnd-teams" className={gridCols[this.config.teamColumns]}>
168178
{captainTeams.map((team, index) => (
169179
<DroppablePlayerList
170180
key={team.id}
@@ -177,7 +187,7 @@ export class Board extends React.Component<BoardProps, BoardState> {
177187

178188
<div
179189
id="dnd-playerpool"
180-
className={`grid-cols-${this.config.playerPoolColumns}`}
190+
className={gridCols[this.config.playerPoolColumns]}
181191
>
182192
{playerPoolTeams.map((team) => (
183193
<DroppablePlayerList

tailwind.config.cjs

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)