2018-12-22 03:10:49 +03:00
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
const ActionPreviewHeader =
|
|
|
|
({ styling, inspectedPath, onInspectPath, tabName, onSelectTab, tabs }) =>
|
2019-01-10 20:23:33 +03:00
|
|
|
(<div key="previewHeader" {...styling('previewHeader')}>
|
2018-12-22 03:10:49 +03:00
|
|
|
<div {...styling('tabSelector')}>
|
|
|
|
{tabs.map(tab =>
|
|
|
|
(<div onClick={() => onSelectTab(tab.name)}
|
|
|
|
key={tab.name}
|
|
|
|
{...styling([
|
|
|
|
'selectorButton',
|
|
|
|
tab.name === tabName && 'selectorButtonSelected'
|
|
|
|
], tab.name === tabName)}>
|
|
|
|
{tab.name}
|
|
|
|
</div>)
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
<div {...styling('inspectedPath')}>
|
|
|
|
{inspectedPath.length ?
|
|
|
|
<span {...styling('inspectedPathKey')}>
|
|
|
|
<a onClick={() => onInspectPath([])}
|
|
|
|
{...styling('inspectedPathKeyLink')}>
|
|
|
|
{tabName}
|
|
|
|
</a>
|
|
|
|
</span> : tabName
|
|
|
|
}
|
|
|
|
{inspectedPath.map((key, idx) =>
|
|
|
|
idx === inspectedPath.length - 1 ? <span key={key}>{key}</span> :
|
|
|
|
<span key={key}
|
|
|
|
{...styling('inspectedPathKey')}>
|
|
|
|
<a onClick={() => onInspectPath(inspectedPath.slice(0, idx + 1))}
|
|
|
|
{...styling('inspectedPathKeyLink')}>
|
|
|
|
{key}
|
|
|
|
</a>
|
|
|
|
</span>
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
</div>);
|
|
|
|
|
|
|
|
export default ActionPreviewHeader;
|