varabyte / kobweb

A modern framework for full stack web apps in Kotlin, built upon Compose HTML
https://kobweb.varabyte.com
Apache License 2.0
1.51k stars 68 forks source link

Generated FaIcons.kt badly indentated #428

Closed kjeller closed 8 months ago

kjeller commented 8 months ago

This is a minor issue where the top of file looks like this:

    //@formatter:off
    @file:Suppress("unused", "SpellCheckingInspection")

    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    // THIS FILE IS AUTOGENERATED.
    //
    // Do not edit this file by hand. Instead, update `fa-icon-list.txt` in the module root and run the Gradle
    // task "generateIcons"
    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    package com.varabyte.kobweb.silk.components.icons.fa

    import androidx.compose.runtime.*
    import com.varabyte.kobweb.compose.ui.Modifier
    import com.varabyte.kobweb.compose.ui.toAttrs
    import org.jetbrains.compose.web.dom.Span

    enum class IconCategory(internal val className: String) {
        REGULAR("far"),
        SOLID("fas"),
        BRAND("fab");
    }

    enum class IconStyle(internal val category: IconCategory) {
        FILLED(IconCategory.SOLID),
        OUTLINE(IconCategory.REGULAR);
    }

    // See: https://fontawesome.com/docs/web/style/size
    enum class IconSize(internal val className: String) {
        // Relative sizes
        XXS("fa-2xs"),
        XS("fa-xs"),
        SM("fa-sm"),
        LG("fa-lg"),
        XL("fa-xl"),
        XXL("fa-2xl"),

        // Literal sizes
        X1("fa-1x"),
        X2("fa-2x"),
        X3("fa-3x"),
        X4("fa-4x"),
        X5("fa-5x"),
        X6("fa-6x"),
        X7("fa-7x"),
        X8("fa-8x"),
        X9("fa-9x"),
        X10("fa-10x");
    }

    @Composable
    fun FaIcon(
        name: String,
        modifier: Modifier,
        style: IconCategory = IconCategory.REGULAR,
        size: IconSize? = null,
    ) {
        Span(
            attrs = modifier.toAttrs {
                classes(style.className, "fa-$name")
                if (size != null) {
                    classes(size.className)
                }
            }
        )
    }

    @Composable fun Fa0(modifier: Modifier = Modifier, size: IconSize? = null) = FaIcon("0", modifier, IconCategory.SOLID, size)
@Composable fun Fa1(modifier: Modifier = Modifier, size: IconSize? = null) = FaIcon("1", modifier, IconCategory.SOLID, size)
@Composable fun Fa2(modifier: Modifier = Modifier, size: IconSize? = null) = FaIcon("2", modifier, IconCategory.SOLID, size)
@Composable fun Fa3(modifier: Modifier = Modifier, size: IconSize? = null) = FaIcon("3", modifier, IconCategory.SOLID, size)
@Composable fun Fa4(modifier: Modifier = Modifier, size: IconSize? = null) = FaIcon("4", modifier, IconCategory.SOLID, size)
@Composable fun Fa5(modifier: Modifier = Modifier, size: IconSize? = null) = FaIcon("5", modifier, IconCategory.SOLID, size)
@Composable fun Fa6(modifier: Modifier = Modifier, size: IconSize? = null) = FaIcon("6", modifier, IconCategory.SOLID, size)
@Composable fun Fa7(modifier: Modifier = Modifier, size: IconSize? = null) = FaIcon("7", modifier, IconCategory.SOLID, size)
@Composable fun Fa8(modifier: Modifier = Modifier, size: IconSize? = null) = FaIcon("8", modifier, IconCategory.SOLID, size)
@Composable fun Fa9(modifier: Modifier = Modifier, size: IconSize? = null) = FaIcon("9", modifier, IconCategory.SOLID, size)
@Composable fun FaA(modifier: Modifier = Modifier, size: IconSize? = null) = FaIcon("a", modifier, IconCategory.SOLID, size)
kjeller commented 8 months ago

This fixes the issue https://github.com/varabyte/kobweb/pull/429 Replaced with this one due to bump v.0.15.5: https://github.com/varabyte/kobweb/pull/430

kjeller commented 8 months ago

Closing this one due to merge https://github.com/varabyte/kobweb/pull/430