package v_builders

import util.TODO
import util.doc39
import v_builders.data.getProducts
import v_builders.htmlLibrary.*

fun getTitleColor() = "#b9c9fe"
fun getCellColor(index: Int, row: Int) = if ((index + row) %2 == 0) "#dce4ff" else "#eff2ff"

fun todoTask39(): Nothing = TODO(
    """
        Task 39.
        1) Fill the table with the proper values from products.
        2) Color the table like a chess board (using getTitleColor() and getCellColor() functions above).
        Pass a color as an argument to functions 'tr', 'td'.
        You can run the 'Html Demo' configuration in IntelliJ IDEA to see the rendered table.
    """,
    documentation = doc39()
)

fun renderProductTable(): String {
    return html {
        table {
            tr {
                td {
                    text("Product")
                }
                td {
                    text("Price")
                }
                td {
                    text("Popularity")
                }
            }
            val products = getProducts()
            todoTask39()
        }
    }.toString()
}

package v_builders

import util.TODO
import util.doc39
import v_builders.data.getProducts
import v_builders.htmlLibrary.*

fun getTitleColor() = "#b9c9fe"
fun getCellColor(row: Int, column: Int) = if ((row + column) %2 == 0) "#dce4ff" else "#eff2ff"

fun todoTask39(): Nothing = TODO(
    """
        Task 39.
        1) Fill the table with the proper values from products.
        2) Color the table like a chess board (using getTitleColor() and getCellColor() functions above).
        Pass a color as an argument to functions 'tr', 'td'.
        You can run the 'Html Demo' configuration in IntelliJ IDEA to see the rendered table.
    """,
    documentation = doc39()
)

fun renderProductTable(): String {
    return html {
        table {
            tr {
                td {
                    text("Product")
                }
                td {
                    text("Price")
                }
                td {
                    text("Popularity")
                }
            }
            val products = getProducts()
            todoTask39()
        }
    }.toString()
}

Improve `getCellColor` naming of arguments
Improve `getCellColor` naming of arguments

* `index` is actually `row`
* `row` is actually `column`

SteveChalker/kotlin-koans,FaustXVI/kotlin-koans,ian-pi/kotlin-koans,mvaldez/kotlin-examples,jensim/kotlin-koans,annekellyc/kotlin-koans,enchf/kotlin-koans,sleberknight/kotlin-koans,enchf/kotlin-koans,FaustXVI/kotlin-koans,usommerl/kotlin-koans,timbotetsu/kotlin-koans,JetBrains/workshop-jb,wickedwukong/kotlin-koans,mvaldez/kotlin-examples,JetBrains/workshop-jb,jasonmfehr/kotlin-koans,nakih/kotlin-koans,trmollet/tuto_kotlin,jasonmfehr/kotlin-koans,johnnywey/kotlin-koans,SteveChalker/kotlin-koans,hughandrewarch/kotlin-koans,thatadamedwards/kotlin-koans,usommerl/kotlin-koans,eviera/kotlin-koans,TheCoinTosser/Kotlin-Koans---Solutions,verhoevenv/kotlin-koans,verhoevenv/kotlin-koans,trmollet/tuto_kotlin,Kotlin/kotlin-koans,TheCoinTosser/Kotlin-Koans---Solutions,ian-pi/kotlin-koans,xcerx/kotlin-koans,Carighan/kotlin-koans,xcerx/kotlin-koans,johnnywey/kotlin-koans,wickedwukong/kotlin-koans,timbotetsu/kotlin-koans,rpandey1234/kotlin-koans,jensim/kotlin-koans,AlexKrupa/kotlin-koans,AlexKrupa/kotlin-koans,nakih/kotlin-koans,eviera/kotlin-koans,Kotlin/kotlin-koans,annekellyc/kotlin-koans,zyallday/kotlin-koans,Yusuzhan/kotlin-koans,ncruz8991/kotlin-koans,thatadamedwards/kotlin-koans,zyallday/kotlin-koans,sleberknight/kotlin-koans,Yusuzhan/kotlin-koans,rpandey1234/kotlin-koans,ncruz8991/kotlin-koans,Riccorl/kotlin-koans,chrisdoc/kotlin-koans,Riccorl/kotlin-koans,hughandrewarch/kotlin-koans,chrisdoc/kotlin-koans,Carighan/kotlin-koans