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

Question: its possible to make a Link component? #124

Open
cloud-walker opened this issue Sep 7, 2016 · 4 comments
Open

Question: its possible to make a Link component? #124

cloud-walker opened this issue Sep 7, 2016 · 4 comments

Comments

@cloud-walker
Copy link

I'm wondering if with cyclejs is possible to craft a generic Link component that accept the route from the props, and manage the click event handler internally.

I saw the dynamic change route section on the readme, but it seems ugly to me as you need to create a class for each link, and map them all on the router: xs.merge ... thing.

@TylorS
Copy link
Member

TylorS commented Sep 7, 2016

but it seems ugly to me as you need to create a class

I've never written a class inside of a Cycle.js application, nor have I seen one :)
The PascalCase is a conventionin the Cycle.js community to distinguish components from other functions.

I don't see any particular reason why a Link component couldn't be create, it just hasn't been yet.

@cloud-walker
Copy link
Author

I mean css class like them:
image

I really have to invent a class to bind every anchor of my application? Or I'm missing something? I'm pretty new here as you may have noticed 😅

@TylorS
Copy link
Member

TylorS commented Sep 7, 2016

You could just listen to anchor tags.
DOM.select('a').events('click')

@jerive
Copy link

jerive commented Nov 6, 2016

To be able to toggle the "active" state of the link, I feel like a feature is missing on RouterSource for this to be possible: the possibility to know whether the current location matches a path (or the current namespace + path part).
Or is there something I missed?

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

No branches or pull requests

3 participants