Nokia HERE maps: How to get the MCZoom and MCPan components? - maps

I want the MCZoom and MCPan components shown in the HERE maps.(Ref picture)
http://here.com/51.506430,-0.127190,13,0,0,normal.day/map=12.966980,77.587290,13,0,0,normal.day
I have tried out all the components listed in the documentation, but none of them renders the MCZoom and MCPan.
If its not something available for public to use, how do I create a component like this?

Related

Using custom html element in react

I am using Typescript and REACT and I want to utilize and wrap some custom html elements in my TSX. For example, I am using a library with a customer html element called ch5-button an it is used in a vanilla html file as such
<ch5-button class="shadow-pulse-button" type="default" shape="circle" label="" iconClass="fas fa-award">
</ch5-button>
I did a ton of searching, but seems like i am not even smart enough to get the search correct to find how to do this. I am not even sure if I have the correct import statement to get those elements -- the closest I got was :
declare var CrComLib: typeof import('#crestron/ch5-crcomlib');
...
const ch5Button = new CrComLib.Ch5Button();
console.log("ch5Button");
console.log(ch5Button);
The console.log display <ch5-button></ch5-button> soI have no idea if I am even on the right track to using this thing. The ch5Button is a class with a lot of methods that look pretty much like what an html element would have but I just dont know what to do with it and how to learn a method for using it. I found some sites that explain how to use observables and such but I am sketchy on if I am heading down the right path. I have attached am image of what some if the properties and methods of the ch5Button looks like in chrome debugger.
Can anyone point me in the right direction? I would create a REACT component that wraps this class and can use props to set the correct attributes etc.
I am very comfortable building REACT apps but admittedly, I am not an advanced developer with it yet but doing my best to learn.

Routing for multi level `slug` url structure with React Router

In my app, I have a hierarchy of categories. Each category has a slug defined in the category entity. What I am trying to achieve is hierarchical structure of the url as well to match the hierarchy of categories.
The resulting page is the landing page of last category in the url.
The app is written with React (with React router).
So, for example I have categories:
category-1
category-2
The url to category 2 should be:
/category-1/category-2
At this point I am digging for a solution and I can really find any best practices to achieve that.
The only thing that I found is recursive paths https://reacttraining.com/react-router/web/example/recursive-paths
This works from a routes perspective, but in this example, the component is actually rendered many times. How do I render it only for the last slug?
Or, am I even in the right direction here? What is the alternative?
Since routes are regular React components, they may be rendered anywhere in the app, including in child elements.
example may help you .

Office Fabric UI custom headers

I am using Office Fabric UI React Detaillist component. I want to add a heading on top of column headers like below:
Please help how to achieve this using offfice Fabric UI React. Reference offuce Fabric UI react detail list below:
https://developer.microsoft.com/en-us/fabric#/components/detailslist
Docs on fabric ui are really outdated. While package is updated regularly (which is great).
Consider looking through source code / examples on github for better understanding of this package.
Looking at IColumn type at https://github.com/OfficeDev/office-ui-fabric-react/blob/master/packages/office-ui-fabric-react/src/components/DetailsList/DetailsList.types.ts#L299
it has
/**
* If provided uses this method to render custom cell content, rather than the default text rendering.
*/
onRender?: (item?: any, index?: number, column?: IColumn) => any;
which you can utilize to render header cell any way you like.
Here are some examples
https://github.com/OfficeDev/office-ui-fabric-react/blob/master/packages/office-ui-fabric-react/src/components/DetailsList/examples/DetailsList.CustomColumns.Example.tsx
https://github.com/OfficeDev/office-ui-fabric-react/blob/master/packages/office-ui-fabric-react/src/components/DetailsList/examples/DetailsList.CustomGroupHeaders.Example.tsx

different nav bar for different pages in react

For my application, I have a nav bar which has different functionality for different pages. ie. 1 page has a map and the search will search for addresses and another page has a list and the search bar will filter the list. There are also different buttons on each page too.
What's the best way to implement something like this in react? I've thought about creating a different search bar component for every page and just rendering a different one for each route but I don't have enough experience in React to go ahead with that decision. Is there a more efficient alternative?
Create a new Navbar component named something like NavBarController. While calling the navbar controller component pass in the "Type" as prop. Type should be a state and should change depending on the page the user is on.
<NavBarController type={1}></NavBarController>
You would just create a few different NavBars and then NavBarController will handle whichever navbar you want to display out of your multiple navbars.
Your NavBarController will return something like this:
return (props.type===1?<NavBarHome/>
:props.type===2?<NavBarMap/>
:props.type===3?<NavBarList/>)

more extensive example implementation code for react-pouchdb-changes

I'm brand new to both pouchdb and react. I found the react-pouchdb-changes module which seems exactly like what I want to be using.
However, the example code it provides is far too sparse - I'm really at a loss as to how it would be incorporated into a basic react application.
Can someone provide a more complete example usage with some basic explanations of what each piece does?
This module seems to be merely a wrapper for the changes method. You can get a live example here. The link comes right from the documentation.
If that's not enough info you can check out the API reference with examples and example responses.
It's up to you how you want react-pouchdb-changes to integrate with React. All it does is provide you with a component to put your onChange handler on. These parts of the code example are the relevant ones:
<PouchDBChanges
…
onChange={change => console.log(change) /* do something useful with the change here instead of just logging it! */}
>
{/* your <App> component here */}
</PouchDBChanges>
Just use the component in your JSX code (wrap your main component or any container component with it).
If you have difficulties with setting up a React example, try using create-react-app. You'll have a running React app within a few seconds. A good place to add your <PouchDBChanges> component would be src/App.js - just wrap the outermost <div> with the component.

Resources