Dynamic color extracted of a value in getTableRecordClassesUsing()

I am trying to have a dynamic color from that value but it does not appear in the row but if I do this from-[#E50914] or any other color, the color is showed
8 Replies
awcodes
awcodes16mo ago
Tailwind doesn’t work that way. It needs a full class name when it runs it’s purge.
Yeraldi29#2900
Yeraldi29#2900OP16mo ago
Ohh, thank you So I will search another way to do this
Yeraldi29#2900
Yeraldi29#2900OP16mo ago
Thank you 🙂
awcodes
awcodes16mo ago
Since your in a callback you can use a match statement to decide which full class name to use. The put that in the string that is returned.
Yeraldi29#2900
Yeraldi29#2900OP16mo ago
Ok, in my case it's a little more challeging because that color is created from the admin and would be changed frecuently, so I need to implement something dynamic
awcodes
awcodes16mo ago
It’s still a register tailwind color though, right. So, bear with me on my phone.
$color = match($record->color) {
‘primary’ => ‘from-primary-500’

default => ‘from-gray-500’
}

return “… {$color} …”;
$color = match($record->color) {
‘primary’ => ‘from-primary-500’

default => ‘from-gray-500’
}

return “… {$color} …”;
Yeraldi29#2900
Yeraldi29#2900OP16mo ago
Thank you so much
Want results from more Discord servers?
Add your server