8000 Support External CSS (Example) · Issue #100 · seanhess/hyperbole · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Support External CSS (Example) #100

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

Open
seanhess opened this issue Mar 24, 2025 · 6 comments
Open

Support External CSS (Example) #100

seanhess opened this issue Mar 24, 2025 · 6 comments

Comments

@seanhess
Copy link
Owner

In #97 @benjamin-thomas tried to implement TodoMVC using their external stylesheet and found it confusing.

Create an example implementing TodoMVC using their stylesheet.

Refactor as necessary to make it not terrible

@benjamin-thomas
Copy link
Contributor

Hi Sean!

I've been playing with your library over the week-end and I'd be happy to contribute an example if you think it'd be useful.

My working example is here: https://github.com/benjamin-thomas/7guis/tree/063a04d7c3bf00fe230b245a124454a3853d7fbe/haskell/hyperbole/app

Can you think of a better way to handle imports?

Regarding this question (from #97 (comment)), I'm thinking it'd be nice to have an alternative "global import", something like import Web.Hyperbole.Minimal, that would only put the bare essentials into scope. The golden path would be to import Web.Hyperbole, not import Web.Hyperbole.Minimal. How does that sound?

Also, if you're open to examples contributions, it'd be interested in contributing "7 GUI" examples, which I think is an interesting benchmark because it's simple enough not to be a time sink, but complex enough to demonstrate tricky interactions and workflows.

Although I've never used vuejs, I've noticed that their doc references the 7 GUI examples (and the traditional todomvc), here: https://vuejs.org/examples/#counter

So, it could be a good way to demonstrate what the library can do, and also to demonstrate useful patterns.

Either separately from the docs.hyperbole.live site, or integrated into it?

I'd expect some examples to require a little bit of javascript to work, which would be interest to show as well.

@seanhess
Copy link
Owner Author

It would be great to have your help!

My working example is here: https://github.com/benjamin-thomas/7guis/tree/063a04d7c3bf00fe230b245a124454a3853d7fbe/haskell/hyperbole/app

If you'd like to submit a PR for the TodoMVC external CSS example, can you do one that only changes the views, but reuses the existing Effect and HyperViews? I believe only the view functions need to change.

Regarding this question (from #97 (comment)), I'm thinking it'd be nice to have an alternative "global import", something like import Web.Hyperbole.Minimal, that would only put the bare essentials into scope. The golden path would be to import Web.Hyperbole, not import Web.Hyperbole.Minimal. How does that sound?

That could work. Alternatively, I could be convinced to flip it on its head and require users to import their own view library of choice. So, something like this?

import Web.Hyperbole
import Web.Hyperbole.View

Then it would be obvious that there are options:

import Web.Hyperbole
import Web.Hyperbole.View.Minimal

I suppose it depends on how often people will want to opt-out of web-view, but it's come up once before, and philosophically, I'm a fan of composition over big default groups. I DO want to encourage users to try out the atomic CSS approach.

Also, if you're open to examples contributions, it'd be interested in contributing "7 GUI" examples, which I think is an interesting benchmark because it's simple enough not to be a time sink, but complex enough to demonstrate tricky interactions and workflows.

Neat. I hadn't heard of 7 GUI. I read the site and agree those would be both a great source of examples and a benchmark of how complete our support is. I'd love to incorporate them into the existing examples site, but the menu is getting long enough we need to start adding some hierarchy. Go break a leg, I'll figure out how to integrate it into the examples site later.

Things to keep in mind

  • Please keep PRs focused: don't implement multiple things in one go
  • Please keep PRs unopinionated: If you want to refactor something let's talk about it first.
  • These need to work against the upcoming version in main, not 0.4. Expect thrash, refactoring, etc.

Thanks!

@seanhess
Copy link
Owner Author

Are there examples of other projects that have figured out how to deal with imports in a way that makes it easy for users following a golden path but doesn't force it down their throats?

@seanhess
Copy link
Owner Author

I opened #101 to separate this thread from the imports issue. let's move all discussion of imports and easy opt-out of web-view there. Let's keep this focused on examples

@benjamin-thomas
Copy link
Contributor

If you'd like to submit a PR for the TodoMVC external CSS example, can you do one that only changes the views, but reuses the existing Effect and HyperViews? I believe only the view functions need to change.

Sounds good to me! I'll keep you posted.

@seanhess
Copy link
Owner Author

With the new atomic-css release, External classes are now as simple as using cls

el ~ cls "some-external-class" . bold $ "hello"

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

2 participants
0