-
Notifications
You must be signed in to change notification settings - Fork 155
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
An HTTP request example and a tailwindcss styling example #305
Conversation
I think it would be better to separate http requests using |
Thanks for reviewing the pull request. That makes sense and I agree. More than happy to split this example into two distinct examples. |
@lukechu10 Hope these are useful examples. |
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.
I'm not sure if it's best to have the tailwindcss example also include http request but I think it's fine for now.
Also CI is failing because latest reqwasm uses edition 2021 which needs rust 1.56 and sycamore's MSRV is currently 1.53. |
f6febaa
to
f25bae1
Compare
@lukechu10
My thinking behind this was that tailwindcss is just a styling layer and it could potentially be added to any existing example. In this case now that we have an isolated example for http why not just extend it and style the relevant component. Also majority of the time projects do contain http requests and styling thought it might represent that side of it in a really simple form. |
Update examples/page-visit-counter-tailwindcss/Trunk.toml Co-authored-by: Luke Chu <37006668+lukechu10@users.noreply.github.com> Update examples/page-visit-counter-tailwindcss/src/main.rs Co-authored-by: Luke Chu <37006668+lukechu10@users.noreply.github.com> Update examples/page-visit-counter-tailwindcss/src/main.rs Co-authored-by: Luke Chu <37006668+lukechu10@users.noreply.github.com>
0a42691
to
3ab3e2c
Compare
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.
lgtm. I'm just waiting for reqwasm to push a new release so that it's compatible with rust 1.53
Codecov Report
@@ Coverage Diff @@
## master #305 +/- ##
==========================================
- Coverage 73.21% 73.20% -0.01%
==========================================
Files 38 40 +2
Lines 5313 5431 +118
==========================================
+ Hits 3890 3976 +86
- Misses 1423 1455 +32
Continue to review full report at Codecov.
|
The non-tailwind example is not needed and is only duplicate code
I removed the non-tailwind example because in retrospect, I think it's better to not have duplicated code |
I created this example (since I could not find an existing one) to get a feel for the developer experience of using a crate like reqwasm and styling with TailwindCSS when using sycamore.
This example makes a
GET
request to CountAPI that simply increments everytime you visit the page or refresh the page i.e. counting page visits. I picked this example since I just wanted to create a really simple HTTP request to fetch somejson
data and then be able to display that data which then further updates aSignal
and resulting into updating the relevant component.This also includes a little styling with TailwindCSS since the docs here suggested that the styling part is still under works.
To test, you can run
trunk serve --open
which should build everything and the serve the page.