Skip to content

mergeClasses

Andrew Sutton edited this page May 20, 2024 · 3 revisions

image

type Styles = {
    backgroundColor: string
    yellowText: string
    borderRadius: string
    redText: string
}

let useStyles = Fui.makeStyles<Styles> [
    "backgroundColor", [
        style.backgroundColor "red"
    ]
    "yellowText", [ style.color "yellow" ]
    "borderRadius", [
        style.borderRadius (20, 5, 20, 5)
    ]
    "redText", [ style.color.red ]
]

[<ReactComponent>]
let MergeClassesTest isYellow =
    let styles = useStyles()

    Html.div [
        prop.className (Fui.mergeClasses (styles.backgroundColor, styles.borderRadius, (if isYellow then styles.yellowText else styles.redText), "testSize" ))
        prop.children [
            Fui.text "Merge Classes Div"
        ]
    ]
Clone this wiki locally