Skip to content
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

css style for document #265

Closed
lazarusA opened this issue Oct 28, 2024 · 5 comments
Closed

css style for document #265

lazarusA opened this issue Oct 28, 2024 · 5 comments

Comments

@lazarusA
Copy link

where should I pass the Styles for the main document? I tried in

Page(; style=Styles(,..))

and

App(; style=Styles(,...)

but none of them are the way mandalorian

@SimonDanisch
Copy link
Owner

SimonDanisch commented Oct 29, 2024

Just put it in the outermost div!

App() do 
   DOM.div(Styles(...), your_page)
end

Let me know if that works!

@lazarusA
Copy link
Author

lazarusA commented Oct 29, 2024

🙅‍♂️I also tried that one. Sorry I didn't include it here.

DOM.div(grid; style=Styles(
            "height" => "100vh",
            "margin" => "0px",
            "background-color" => "#1a1a1a",
            "padding" => "0px",
            # "margin-left" => "0px",
            CSS("body" => "margin: 0; padding: 0; overflow: hidden; background-color: #1a1a1a;")
        ))

and nope. I don't find the body, or my syntax is off.

@SimonDanisch
Copy link
Owner

You can create the whole document with DOM.body/meta/html

@sprig
Copy link

sprig commented Jan 16, 2025

I think the confusion might be due to a bug in how styles get included:

julia> ss=Styles(CSS("height"=>"100%","width"=>"100%","background"=>"black"))
 {
  height: 100%;
  width: 100%;
  background: black;
}


julia> string(DOM.div(style=ss))
"<div style=\" {&#10;  height: 100%;&#10;  width: 100%;&#10;  background: black;&#10;}&#10;\"></div>"

And wrapping in App will not make a black page. On the other hand, directly writing the style as a literal string in style=... works.
This is Bonito v4.0.1 With Julia 1.11 on Arm Mac.

@sprig
Copy link

sprig commented Jan 16, 2025

My apologies - in my case I was trying to render the html directly in order to push to electron (I know about the electron integration, but I preferred to manage the window myself). However, the page was still making calls to the bonito server, and they were getting blocked by cors. As far as I understand this was the cause of the error, since the page renders correctly both in browser and in electron when loading the url.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants