Haruki
11/14/2022, 7:10 PMi("fa-light fa-trash-can"){}
as we implement it on static HTML by <i class="fa-light fa-trash-can"></i>
. However, this doesn't work since it seems like the way I added the class attribute doesn't work. I would like to know how you usually add fancy icons and class attributes on kotlin react.
import react.*
import kotlinx.coroutines.*
import react.dom.html.ReactHTML.h1
import <http://react.dom.html.ReactHTML.li|react.dom.html.ReactHTML.li>
import react.dom.html.ReactHTML.ul
val App = FC<Props> {
h1 {
+"Full-Stack Shopping List"
}
}
turansky
11/14/2022, 7:45 PMh1 {
+"Full-Stack Shopping List"
i {
className = ClassName("fa-light fa-trash-can")
}
}
Haruki
11/14/2022, 9:46 PMturansky
11/15/2022, 8:21 AMobject FA {
inline val light: ClassName
get() = ClassName("fa-light")
inline val trashCan: ClassName
get() = ClassName("fa-trash-can")
}
h1 {
+"Full-Stack Shopping List"
i {
className = cx(FA.light, FA.trashCan)
}
}