How to use the @nearform/clinic-common/base/drop-down.js function in @nearform/clinic-common

To help you get started, we’ve selected a few @nearform/clinic-common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nearform / node-clinic-flame / visualizer / perc-dropdown.js View on Github external
module.exports = () => {
  const wrapper = dropdown()

  wrapper.showNodeInfo = (node, dataTree) => {
    const totalValue = dataTree && dataTree.activeTree().value
    const stackPercentages = {
      top: Math.round(100 * (node.onStackTop.asViewed / totalValue) * 10) / 10,
      overall: Math.round(100 * (node.value / totalValue) * 10) / 10
    }

    wrapper.update({
      label: `${stackPercentages.top}%`,
      content: `
    <div>
      <h2>Stack info</h2>
      <p class="frame-percentage frame-percentage-top">Top of stack: ${stackPercentages.top}%</p>
      <p class="frame-percentage frame-percentage-overall">On stack: ${stackPercentages.overall}%</p>
    </div>`

@nearform/clinic-common

Shared parts between the Clinic.js suite

MIT
Latest version published 4 years ago

Package Health Score

42 / 100
Full package analysis

Similar packages