const headerStyles = {
color: 'white',
};
const featureStyles = {
padding: 10,
};
const featureAStyles = {
...featureStyles,
backgroundColor: '#105c8e',
};
const featureBStyles = {
...featureStyles,
backgroundColor: '#a24936',
marginTop: 10,
};
const featureCStyles = {
...featureStyles,
backgroundColor: '#2c1320',
marginTop: 10,
flex: 1,
};
function TrackableFeature() {
const [trackedPath, setTrackedPath] = React.useState({});
return (
<Provider
value="Voltron"
property="application"
onTrack={(propertyMap, action, event) => {
setTrackedPath(propertyMap);
console.log('fullPath', propertyMap);
console.log('action', action);
console.log('event', event);
}}
>
<div style={featureAStyles}>
<h2 style={headerStyles}>Application (Voltron)</h2>
<Provider value="Documentation" property="platform">
<div style={featureBStyles}>
<h3 style={headerStyles}>Platform (Documentation)</h3>
<div style={{ display: 'flex' }}>
<Provider value="Navigation" property="feature">
<div style={{ ...featureCStyles, marginRight: 5 }}>
<h3 style={headerStyles}>Feature (Navigation)</h3>
<Button onClick={() => {}}>Navigation Item</Button>
</div>
</Provider>
<Provider value="Content" property="feature">
<div style={{ ...featureCStyles, flex: 2, marginLeft: 5 }}>
<h3 style={headerStyles}>Feature (Content)</h3>
<Button onClick={() => {}}>Content Button</Button>
</div>
</Provider>
</div>
</div>
</Provider>
</div>
<hr />
<div>
Full tracked object: <pre>{JSON.stringify(trackedPath, null, 2)}</pre>
</div>
</Provider>
);
}
render(<TrackableFeature />);