Comments (7)
I like it. I admit, the HopscotchBubble.render function always felt kind of clunky to me.
Handling events should be pretty easy -- you could just do event delegation on the bubble container, and have clients choose specific IDs or classes for the elements whose events Hopscotch needs to listen to. E.g., for the next button, you must assign an ID of hopscotch-next
.
Not really sure what you mean by having render be responsible for the structure of the whole bubble. Can you elaborate?
Love the idea!
from hopscotch.
Perhaps just some musing over the split of responsibilities between the theme and the framework, which in this case is expressed as whether render() handles just the innerHTML of the bubble (Hopscotch creates the "bubble" for you to render your content into) or actually renders the bubble itself - arrow and all. Of course, if we put too much responsibility on this render() method (or, more broadly, the theme), then it just ends up as a re-implementation of HopscotchBubble. But then... maybe that might be ok? It gives the end user full control over everything involved with visually showing the bubble.
Makes sense to me to have one event listener on the bubble and do event delegation. I'm on the fence with requiring magic IDs for binding actions... this could be configurable, but then what are the compelling cases for configuring those action selectors?
from hopscotch.
This is a great idea. It will definitely give more flexibility to the users.
Will this render function be used to render each step or just scaffolding of the hopscotch bubble? In other words, will content and title of a step still come from tour's steps config JSON, or will they be rendered as part of template?
If it is just scaffolding, I would be in favor of having this render function render the whole bubble (minus content and title), including outer container and arrow.
from hopscotch.
Well, as things have evolved... both. I've been working on this on my fork and so far I've broken things down into two templates. The first template renders the scaffolding for the bubble and is only called once during initialization. The second template is for rendering the internal content of the bubble and is called every step of the tour - this second render method receives JSON specifying details about the step.
That said, I'm playing around with the idea of merging the two templates into one. At first, it felt appropriate to break the two components (structure and content) apart given the current code structure, but only having to set one renderer would be more straightforward for end users. The downside of this is that we'll have to reset the references to the arrow element and content element on each rerender.
from hopscotch.
I wonder if there is a way we could support both templates (bubbleShellTemplate
and bubbleContentTemplate
), but make both of them optional? Both templates can take on as much responsibility as user wants them to. If user wants to render full bubble with bubbleContentTemplate
they could.
bubbleShellTemplate
would be executed once per tour. bubbleContentTemplate
would be executed once per step.
This is just an idea to kick around. I haven't thought through it in much detail.
from hopscotch.
Maybe, but the idea of the shell template was to create particular DOM elements (hopscotch-content
and hopscotch-arrow
) that the control can cache references of, so if we had both, they'd both be required (or at least require defaults). That said, I've done some refactoring to allow everything to be rendered by one template, since we don't need those DOM references until render()
anyway.
The code I have is getting pretty close to complete, so I should be able to publish a pull request and readme by later this week, once the directory restructuring is complete and I've merged my changes over into the new structure.
from hopscotch.
Pull request #70 merged.
from hopscotch.
Related Issues (20)
- SVGs for sprites?
- Using functions or helpers for target prop
- How to use this library using TypeScript in ng4? HOT 1
- How would I implement a way to cancel the tour if the user navigates away?
- Current step
- FeatureRequest: on-demand Tours
- Hopscotch with tabset
- Issue with going back between multi-site steps between pages
- nextOnTargetClick doesn't work while animating in.
- onStart and onEnd being executed as soon as I start the tour. HOT 1
- How to set up onNext function, when using a database to set up the steps properties? HOT 11
- How to create multiple tours on one page? HOT 5
- sprite-green and sprite-orange don't work HOT 2
- Is it possible to fixe the "popup" on not fixed target
- Customizable theme (background color and text color)
- Visibility for templating and `setRenderer` HOT 1
- Add multiple pages for tour?
- Why previous and Next button displayed after some delay in safari 12.1?
- hopscotch and iframes
- Addclass not working HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hopscotch.