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

Material UI doesn't work as provided in documentation #47

Open
MadMed677 opened this issue Jul 7, 2024 · 3 comments
Open

Material UI doesn't work as provided in documentation #47

MadMed677 opened this issue Jul 7, 2024 · 3 comments

Comments

@MadMed677
Copy link

Hello @ranile! I've faced with the problem and maybe you could help me to understand how to fix it.

Problem description

Step 1

When I'm trying to use material yew based on documentation page

use material_yew::MatButton;
use yew::html;

html! {
    <MatButton label="Click me!" />
};

I've faced with an error: unresolved import material_yew::MatButtonthe item is gated behind thebutton feature

Step 2

If I add button feature

material-yew = { version = "0.3.0", features = ["button"] }

I see the following error:

the trait bound `material_yew::MatButton: yew::Component` is not satisfied
the trait `yew::Component` is implemented for `yew::ContextProvider<T>`
required for `material_yew::MatButton` to implement `yew::BaseComponent`

I guess this is because I'm using a new version of yew which is 0.21.0 and the traits has been changed since last material-yew publish.

@ranile
Copy link
Owner

ranile commented Jul 7, 2024

@MadMed677 yes, the published version is quite old. you should take a dependency from git, which should be fine

@MadMed677
Copy link
Author

Maybe I did something wrong but even if I fetch yew from Git and Material Yew from Git the result error will be the same

First option

Cargo.toml

[dependencies]
material-yew = { git = "https://github.com/ranile/material-yew", branch="material-3" }
web-sys = "0.3.69"
yew = { git = "https://github.com/yewstack/yew", features = ["csr"] }

The error says that 32 times for every component:

cannot find function `__dummy_loader` in this scope
crate::import_material_web_module!("/md-web/radio.js")
   |         ------------------------------------------------------ in this macro invocation

Other options

All other implementation have the same problem

<MatButton label="Add" raised=true>{"Add one"}</MatButton>
   |              ^^^^^^^^^ the trait `yew::Component` is not implemented for `MatButton`, which is required by `MatButton: yew::BaseComponent`

@ranile
Copy link
Owner

ranile commented Jul 11, 2024

@MadMed667 right, the git one gives you an error, I should've expected that. It can't find the modules

I suggest you clone the repo and then use a path dependency for now. You'll you invoke rollup yourself

cd build
npm install
npm run build

This should fix your JS files not available issue.

One good way of permanently solving this problem is having a build script that calls npm run build. I would be happy to take a look at any PRs for it. I used to include build files in the repo but in light of the XZ exploit that was found, I'm not really comfortable doing that and telling others to use it. It would be best if end users invoked rollup themselves to bundle the martial components this library uses

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