-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kutty-bootstrap: Table #13
Comments
Could you please enumerate all the possible variations and show code examples with the proposed API? |
Yes. I imagined it to be the same as the previous Table element, with some extra keyword arguments. Like: from kuty import Table
table1 = Table(columns=["a", "b", "c", "d"], striped=True, color_style="dark")
table1.add_row(["e", "f", "g", "h"])
table1.add_row(["i", "j", "k", "l"]) I'm not sure if color_style is the right name for it. It could be something other than dark or light also, something like primary, secondary, info, danger, etc. is also acceptable. I'm not sure if we should support it like that (that would couple it with bootstrap too tightly) but also losing out on that would mean less power to us. |
Let's keep the core table aside for now. Let's see how to represent the
bootstrap table supporting all the variations.
…On Wed, Jan 4, 2023, 11:49 AM Kaustubh Maske Patil ***@***.***> wrote:
Yes. I imagined it to be the same as the previous Table element, with some
extra keyword arguments. Like:
from kuty import Table
table1 = Table(columns=["a", "b", "c", "d"], striped=True, color_style="dark")table1.add_row(["e", "f", "g", "h"])table1.add_row(["i", "j", "k", "l"])
I'm not sure if color_style is the right name for it. It could be
something other than dark or light also, something like primary, secondary,
info, danger, etc. is also acceptable. I'm not sure if we should support it
like that (that would couple it with bootstrap too tightly) but also losing
out on that would mean less power to us.
—
Reply to this email directly, view it on GitHub
<#13 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAB3EM5UHF56UA2WG43G73WQUI5PANCNFSM6AAAAAATPWLZJE>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
`color_style` doesn't sound right. We'll have to come up with a consistent
vocabulary for all the components.
…On Wed, Jan 4, 2023, 11:57 AM Anand Chitipothu ***@***.***> wrote:
Let's keep the core table aside for now. Let's see how to represent the
bootstrap table supporting all the variations.
On Wed, Jan 4, 2023, 11:49 AM Kaustubh Maske Patil <
***@***.***> wrote:
> Yes. I imagined it to be the same as the previous Table element, with
> some extra keyword arguments. Like:
>
> from kuty import Table
> table1 = Table(columns=["a", "b", "c", "d"], striped=True, color_style="dark")table1.add_row(["e", "f", "g", "h"])table1.add_row(["i", "j", "k", "l"])
>
> I'm not sure if color_style is the right name for it. It could be
> something other than dark or light also, something like primary, secondary,
> info, danger, etc. is also acceptable. I'm not sure if we should support it
> like that (that would couple it with bootstrap too tightly) but also losing
> out on that would mean less power to us.
>
> —
> Reply to this email directly, view it on GitHub
> <#13 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAAB3EM5UHF56UA2WG43G73WQUI5PANCNFSM6AAAAAATPWLZJE>
> .
> You are receiving this because you commented.Message ID:
> ***@***.***>
>
|
Yes. I agree. |
I'm thinking of this API for Tables: from kutty import html
from kutty.bootstrap import Table, TableHead, TableBody, TableRow
# recommended usage style:
table = Table(columns=["#", "First Name", "Last Name", "Nickname"])
table.add_row(["1", "Foo", "Bar", "Baz"])
table.add_row(["2", "Spam", "Ham", "Eggs"])
# advanced usage style:
table = Table(
TableHead(
TableRow(
html.th("#", scope="col"),
html.th("First Name", scope="col"),
html.th("Last Name", scope="col"),
html.th("Nickname", scope="col"),
)
),
TableBody(
TableRow(html.td("1"), html.td("Foo"), html.td("Bar"), html.td("Baz")),
TableRow(html.td("2"), html.td("Spam"), html.td("Ham"), html.td("Eggs")),
)
)
# TableRow can also be initialised like this:
row = TableRow(items=["1", "Foo", "Bar", "Baz"]) The advanced usage style doesn't look very nice in this case, but the other usage style looks very usable. |
We will need to use this Bootstrap component: https://getbootstrap.com/docs/4.6/content/tables/
For Tables, we should follow the style in https://github.com/pipalacademy/kutty/blob/1e20a839a502f0cd9a970afb5bc3052c00615e39/kutty/components/table.py
The tables can be themed, but the default style works well too. I think keyword arguments would be a good way to pass the style in this case, because
StripedTable
orDarkTable
are not that different to be separated out, and a table could be both dark and striped.The text was updated successfully, but these errors were encountered: