Alex Styl
12/09/2021, 1:19 PM@font-face {
src: url("/fonts/Urbanist.ttf");
font-family: urbanist;
}
So far I got:
call.respondCss {
fontFace {
fontFamily = "urbanist"
}
}
but I cannot find a way to populate the src value.
(also, please let me know if this is not the right place to ask this)var StyledElement.src: String by CssProperty()
// copy pasted in my file to be accessible
private class CssProperty<T>(private val default: (() -> T)? = null) {
operator fun getValue(thisRef: StyledElement, property: KProperty<*>): T {
default?.let { default ->
if (!thisRef.declarations.containsKey(property.name)) {
thisRef.declarations[property.name] = default() as Any
}
}
@Suppress("UNCHECKED_CAST")
return thisRef.declarations[property.name] as T
}
operator fun setValue(thisRef: StyledElement, property: KProperty<*>, value: T) {
thisRef.declarations[property.name] = value as Any
}
}
Matteo Mirk
12/09/2021, 2:50 PMAleksei Tirman [JB]
12/10/2021, 7:25 AMAlex Styl
12/10/2021, 10:02 AM