-
Notifications
You must be signed in to change notification settings - Fork 291
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
Add class property to box component #990
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
import mesop as me | ||
|
||
|
||
@me.page( | ||
security_policy=me.SecurityPolicy( | ||
allowed_iframe_parents=["https://google.github.io"] | ||
), | ||
stylesheets=[ | ||
"/assets/bootstrap.css", | ||
], | ||
path="/bootstrap", | ||
) | ||
def page(): | ||
with me.box(classes="container"): | ||
with me.box( | ||
classes="d-flex flex-wrap justify-content-center py-3 mb-4 border-bottom", | ||
): | ||
with me.box( | ||
classes="d-flex align-items-center mb-3 mb-md-0 me-md-auto link-body-emphasis text-decoration-none fs-4", | ||
): | ||
me.text("Mesop") | ||
|
||
with me.box(classes="nav nav-pills"): | ||
with me.box(classes="nav-item"): | ||
with me.box(classes="nav-link active"): | ||
me.text("Pricing") | ||
with me.box(classes="nav-item"): | ||
with me.box(classes="nav-link"): | ||
me.text("Features") | ||
with me.box(classes="nav-item"): | ||
with me.box(classes="nav-link"): | ||
me.text("About") | ||
|
||
with me.box(classes="container px-4 py-5"): | ||
with me.box(classes="pb-2 border-bottom"): | ||
me.text("Columns", type="headline-5") | ||
|
||
with me.box(classes="row g-4 py-5 row-cols-1 row-cols-lg-3"): | ||
with me.box(classes="feature col"): | ||
with me.box(classes="fs-2 text-body-emphasis"): | ||
me.text("Featured title") | ||
me.text( | ||
"Paragraph of text beneath the heading to explain the heading. We'll add onto it with another sentence and probably just keep going until we run out of words." | ||
) | ||
me.link(text="Call to action", url="/#") | ||
|
||
with me.box(classes="feature col"): | ||
with me.box(classes="fs-2 text-body-emphasis"): | ||
me.text("Featured title") | ||
me.text( | ||
"Paragraph of text beneath the heading to explain the heading. We'll add onto it with another sentence and probably just keep going until we run out of words." | ||
) | ||
me.link(text="Call to action", url="/#") | ||
|
||
with me.box(classes="feature col"): | ||
with me.box(classes="fs-2 text-body-emphasis"): | ||
me.text("Featured title") | ||
me.text( | ||
"Paragraph of text beneath the heading to explain the heading. We'll add onto it with another sentence and probably just keep going until we run out of words." | ||
) | ||
me.link(text="Call to action", url="/#") | ||
|
||
with me.box( | ||
classes="d-flex flex-wrap justify-content-between align-items-center py-3 my-4 border-top" | ||
): | ||
with me.box(classes="col-md-4 mb-0 text-body-secondary"): | ||
me.text("Copyright 2024 Mesop") | ||
|
||
with me.box( | ||
classes="col-md-4 d-flex align-items-center justify-content-center mb-3 mb-md-0 me-md-auto link-body-emphasis text-decoration-none" | ||
): | ||
me.icon("home") | ||
|
||
with me.box(classes="nav col-md-4 justify-content-end"): | ||
with me.box(classes="nav-item"): | ||
with me.box(classes="nav-link px-2 text-body-secondary"): | ||
me.text("Home") | ||
with me.box(classes="nav-item"): | ||
with me.box(classes="nav-link px-2 text-body-secondary"): | ||
me.text("Features") | ||
with me.box(classes="nav-item"): | ||
with me.box(classes="nav-link px-2 text-body-secondary"): | ||
me.text("Pricing") | ||
with me.box(classes="nav-item"): | ||
with me.box(classes="nav-link px-2 text-body-secondary"): | ||
me.text("FAQs") | ||
with me.box(classes="nav-item"): | ||
with me.box(classes="nav-link px-2 text-body-secondary"): | ||
me.text("About") |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
import mesop as me | ||
|
||
|
||
@me.page( | ||
security_policy=me.SecurityPolicy( | ||
allowed_iframe_parents=["https://google.github.io"] | ||
), | ||
stylesheets=[ | ||
"/assets/tailwind.css", | ||
], | ||
path="/tailwind", | ||
) | ||
def app(): | ||
with me.box(classes="grid grid-cols-10 gap-2"): | ||
with me.box(classes="bg-sky-50 aspect-square"): | ||
pass | ||
with me.box(classes="bg-sky-100 aspect-square"): | ||
pass | ||
with me.box(classes="bg-sky-200 aspect-square"): | ||
pass | ||
with me.box(classes="bg-sky-300 aspect-square"): | ||
pass | ||
with me.box(classes="bg-sky-400 aspect-square"): | ||
pass | ||
with me.box(classes="bg-sky-500 aspect-square"): | ||
pass | ||
with me.box(classes="bg-sky-600 aspect-square"): | ||
pass | ||
with me.box(classes="bg-sky-700 aspect-square"): | ||
pass | ||
with me.box(classes="bg-sky-800 aspect-square"): | ||
pass | ||
with me.box(classes="bg-sky-900 aspect-square"): | ||
pass | ||
|
||
with me.box(classes="grid grid-cols-10 gap-2"): | ||
with me.box(classes="bg-blue-50 aspect-square"): | ||
pass | ||
with me.box(classes="bg-blue-100 aspect-square"): | ||
pass | ||
with me.box(classes="bg-blue-200 aspect-square"): | ||
pass | ||
with me.box(classes="bg-blue-300 aspect-square"): | ||
pass | ||
with me.box(classes="bg-blue-400 aspect-square"): | ||
pass | ||
with me.box(classes="bg-blue-500 aspect-square"): | ||
pass | ||
with me.box(classes="bg-blue-600 aspect-square"): | ||
pass | ||
with me.box(classes="bg-blue-700 aspect-square"): | ||
pass | ||
with me.box(classes="bg-blue-800 aspect-square"): | ||
pass | ||
with me.box(classes="bg-blue-900 aspect-square"): | ||
pass | ||
|
||
with me.box(classes="grid grid-cols-10 gap-2"): | ||
with me.box(classes="bg-indigo-50 aspect-square"): | ||
pass | ||
with me.box(classes="bg-indigo-100 aspect-square"): | ||
pass | ||
with me.box(classes="bg-indigo-200 aspect-square"): | ||
pass | ||
with me.box(classes="bg-indigo-300 aspect-square"): | ||
pass | ||
with me.box(classes="bg-indigo-400 aspect-square"): | ||
pass | ||
with me.box(classes="bg-indigo-500 aspect-square"): | ||
pass | ||
with me.box(classes="bg-indigo-600 aspect-square"): | ||
pass | ||
with me.box(classes="bg-indigo-700 aspect-square"): | ||
pass | ||
with me.box(classes="bg-indigo-800 aspect-square"): | ||
pass | ||
with me.box(classes="bg-indigo-900 aspect-square"): | ||
pass | ||
|
||
with me.box(classes="grid grid-cols-10 gap-2"): | ||
with me.box(classes="bg-violet-50 aspect-square"): | ||
pass | ||
with me.box(classes="bg-violet-100 aspect-square"): | ||
pass | ||
with me.box(classes="bg-violet-200 aspect-square"): | ||
pass | ||
with me.box(classes="bg-violet-300 aspect-square"): | ||
pass | ||
with me.box(classes="bg-violet-400 aspect-square"): | ||
pass | ||
with me.box(classes="bg-violet-500 aspect-square"): | ||
pass | ||
with me.box(classes="bg-violet-600 aspect-square"): | ||
pass | ||
with me.box(classes="bg-violet-700 aspect-square"): | ||
pass | ||
with me.box(classes="bg-violet-800 aspect-square"): | ||
pass | ||
with me.box(classes="bg-violet-900 aspect-square"): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -260,6 +260,10 @@ body { | |
} | ||
} | ||
|
||
component-renderer { | ||
display: block; | ||
} | ||
|
||
mesop-markdown { | ||
h1, | ||
h2, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
--default-bottom-panel-height: 400px; | ||
} | ||
|
||
.container { | ||
.sidenav-container { | ||
height: 100%; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<mat-sidenav-container class="container"> | ||
<mat-sidenav-container class="sidenav-container"> | ||
<mat-sidenav-content #sidenavContent class="content"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm curious, was this causing a naming conflict with bootstrap? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, they have a class named "container". So when I first tried loading the bootstrap.css, the layout was messed up and eventually tracked it down to this usage. |
||
<mesop-shell></mesop-shell> | ||
@defer (when showEditorToolbar()) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
.container { | ||
.sidenav-container { | ||
height: 100%; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks like below you're supporting both
"foo bar"
and["foo", "bar"]
? I would type this aslist[str] | str
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's what I wanted to support initially. But ran into an issue with that annotation. I think just needed to update the code in the component maker code to handle that annotation. But since I just wanted a to get a quick draft up, just left it as is.
But I guess, I wonder if we need to allow a list. We could have a me.convert_class_list type helper if people are dynamically generating class names. I think I'd lean toward allowing people to pass in lists for the dynamic class name case rather than introducing a helper function.