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

Examples should be brought up to date and made prettier #1016

Closed
ZainlessBrombie opened this issue Mar 10, 2020 · 24 comments
Closed

Examples should be brought up to date and made prettier #1016

ZainlessBrombie opened this issue Mar 10, 2020 · 24 comments
Labels
A-examples Area: The examples feature-request A feature request

Comments

@ZainlessBrombie
Copy link
Collaborator

Is your feature request related to a problem? Please describe.
The features currently don't look very pleasing and e.g. the webgl one didn't compile. It might be a good idea to bring them up to date / do a new set of examples.

Describe the solution you'd like
Someone (could be me) should redo the examples with proper css styling and bring them up to date

Describe alternatives you've considered
We could keep them looking the way they do right now for simplicities sake, but I think some styling won't hurt. We need to represent ourselves after all :)

Additional context
A) I'd redo the examples but while I'm full stack design is not one of my primary skills. Might need some pointers from someone regarding the design after the initial draft.
B) Here is a simple little styled component class I wrote. Mind if I use it for styling in the examples?
https://pastebin.com/j2qtsmTm
C) Do we still need to support std_web for the examples? It would be simpler to just go with web_sys imho, after all std_web has seen no activity in the past months and web_sys is more official

@ZainlessBrombie ZainlessBrombie added the feature-request A feature request label Mar 10, 2020
@ZainlessBrombie
Copy link
Collaborator Author

ZainlessBrombie commented Mar 10, 2020

I could also improve the performance of the style class I provided :)
Or use https://docs.rs/styled-yew/0.2.0/styled_yew/, of course

@jstarry
Copy link
Member

jstarry commented Mar 11, 2020

I'd redo the examples but while I'm full stack design is not one of my primary skills. Might need some pointers from someone regarding the design after the initial draft.

I'd prefer if they used an existing theme or library. One of these would be nice:

Here is a simple little styled component class I wrote

Nice!

Mind if I use it for styling in the examples?

I would prefer to keep the code very simple for the examples. It's more important that they are quick to understand and play with than look nice. I think that we could it for one of the examples, though.

Do we still need to support std_web for the examples? It would be simpler to just go with web_sys imho, after all std_web has seen no activity in the past months and web_sys is more official

So long as:

  • Yew maintains support for stdweb
  • stdweb isn't officially dead
  • people still want to use cargo-web

we should keep examples that support stdweb That said, I don't think that new examples need to support both.

@jstarry
Copy link
Member

jstarry commented Mar 11, 2020

the webgl one didn't compile

This one was just added, do you mind creating an issue for this?

@ZainlessBrombie
Copy link
Collaborator Author

ZainlessBrombie commented Mar 11, 2020

https://yew-ex-v1.single-page.zainlessbackend.com/
Example of how the examples would look. Code at https://github.com/ZainlessBrombie/yew-examples-redone
Ripping plenty from the existing examples ^^

@jstarry
Copy link
Member

jstarry commented Mar 12, 2020

Love the UI update!! <3 <3

@ZainlessBrombie
Copy link
Collaborator Author

Lovely, thanks! 😊

@ZainlessBrombie
Copy link
Collaborator Author

ZainlessBrombie commented Mar 12, 2020

@ZainlessBrombie
Copy link
Collaborator Author

https://crm2.examples.yew.rs
New crm example

@ZainlessBrombie
Copy link
Collaborator Author

https://fragments2.examples.yew.rs
New fragments example

@ZainlessBrombie
Copy link
Collaborator Author

ZainlessBrombie commented Mar 12, 2020

https://futures2.examples.yew.rs
This one is fresh from the web_sys documentation, not from the old example ;)
It uses the wasm_bindgen_futures crate

@ZainlessBrombie
Copy link
Collaborator Author

ZainlessBrombie commented Mar 12, 2020

Alright on the todo-list are:

  • A Websocket global chatroom (I'd use my personal server as the host)
  • A multithreading demonstration
  • A demonstration of mount points / having two apps in parallel
  • A node_refs demonstration
  • A file upload example (maybe one that displays the contents of the uploaded zip file?)
  • A js callback demonstration
  • A super large table demonstration
  • A fetch / web request demonstration
  • A yew router demo
  • A hooks API demo
    Am I missing anything?

@ZainlessBrombie
Copy link
Collaborator Author

Also, I'll look into building some adapter for react-like functional components and redux store :)

@ZainlessBrombie
Copy link
Collaborator Author

I can do this now 🎉 🎉
image

@jstarry
Copy link
Member

jstarry commented Mar 13, 2020

Awesome! Can you create a new issue for that and describe the API?

@ZainlessBrombie
Copy link
Collaborator Author

Huh multithreading is not working at all. It can't find the files needed to work the worker, seems the project has to be set up in a very specific way for that. Wonder how we can fix that

@jstarry
Copy link
Member

jstarry commented Mar 15, 2020

The web-sys multithread example? There is a readme for that, it's an unusual setup

@jstarry
Copy link
Member

jstarry commented Apr 27, 2020

@ZainlessBrombie where did you leave off with example updates? I think we could leverage some community component libraries to help with this effort

@ZainlessBrombie
Copy link
Collaborator Author

ZainlessBrombie commented Apr 27, 2020

I honestly did not continue after updating this and focused on the hooks API. I have not forgotten about it though, I'm just pretty booked right now :)
Current State: https://yew-ex-v2.single-page.zainlessbackend.com/
(Last one should be triggered on a button press so its clear what it does)

@jstarry
Copy link
Member

jstarry commented Apr 28, 2020

@ZainlessBrombie no worries! take your time :)

@jstarry jstarry added the A-examples Area: The examples label Jun 8, 2020
@p-alik
Copy link
Contributor

p-alik commented Jul 11, 2020

For the todomvc one I'm getting an error
Uncaught SyntaxError: Cannot use 'import.meta' outside a module

I run in the issue also. What causes the issue and how it could be solved?

@teymour-aldridge
Copy link
Contributor

My suspicion is that is an error caused by rules around how ES5 (a Javascript specification – not sure if it's ES5 of ES6) defined Javascript modules. I'd suggest making sure the relevant <script> tags have type "module" i.e. <script type="module"> and checking if that makes a difference?

@p-alik
Copy link
Contributor

p-alik commented Jul 11, 2020

The exception disappears if this line

<script src="/todomvc.js"></script>

is modified as suggested. But in this case my browsers (Firefox 75.0, Chromium 81.0.4044.113) show an empty page.

p-alik added a commit to p-alik/yew that referenced this issue Jul 11, 2020
- makes it ready for wasm-pack build

mentioned in issues yewstack#1079 and yewstack#1016
p-alik added a commit to p-alik/yew that referenced this issue Jul 11, 2020
- makes it ready for wasm-pack build

mentioned in issues yewstack#1079 and yewstack#1016
therustmonk pushed a commit to p-alik/yew that referenced this issue Jul 19, 2020
- makes it ready for wasm-pack build

mentioned in issues yewstack#1079 and yewstack#1016
therustmonk pushed a commit to p-alik/yew that referenced this issue Jul 20, 2020
- makes it ready for wasm-pack build

mentioned in issues yewstack#1079 and yewstack#1016
siku2 pushed a commit that referenced this issue Jul 20, 2020
* amendment of todomvc example

- makes it ready for wasm-pack build

mentioned in issues #1079 and #1016

* Update examples/todomvc/README.md

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>

* Update examples/todomvc/README.md

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>

* Update examples/todomvc/README.md

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>
teymour-aldridge added a commit to teymour-aldridge/yew that referenced this issue Jul 20, 2020
* amendment of todomvc example

- makes it ready for wasm-pack build

mentioned in issues yewstack#1079 and yewstack#1016

* Update examples/todomvc/README.md

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>

* Update examples/todomvc/README.md

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>

* Update examples/todomvc/README.md

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>
jstarry pushed a commit that referenced this issue Aug 16, 2020
* amendment of todomvc example

- makes it ready for wasm-pack build

mentioned in issues #1079 and #1016

* Update examples/todomvc/README.md

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>

* Update examples/todomvc/README.md

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>

* Update examples/todomvc/README.md

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>
teymour-aldridge added a commit to teymour-aldridge/yew that referenced this issue Sep 1, 2020
* amendment of todomvc example

- makes it ready for wasm-pack build

mentioned in issues yewstack#1079 and yewstack#1016

* Update examples/todomvc/README.md

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>

* Update examples/todomvc/README.md

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>

* Update examples/todomvc/README.md

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>
@siku2 siku2 mentioned this issue Sep 18, 2020
3 tasks
@siku2
Copy link
Member

siku2 commented May 18, 2021

I think this has been achieved to a reasonable degree (there will always be things to improve) so I'm going to close this now.

@siku2 siku2 closed this as completed May 18, 2021
@NickLarsenNZ
Copy link

This should be moved to Done in the relevant projects

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-examples Area: The examples feature-request A feature request
Projects
None yet
Development

No branches or pull requests

6 participants