Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Footer align does not work #66

Open
muuvmuuv opened this issue Jul 2, 2020 · 1 comment
Open

Footer align does not work #66

muuvmuuv opened this issue Jul 2, 2020 · 1 comment

Comments

@muuvmuuv
Copy link

muuvmuuv commented Jul 2, 2020

Problem Summary

I am trying to align a footer cell to right.

Expected Result (screen shot if possible)

Actual Result (screen shot if possible)

Bildschirmfoto 2020-07-02 um 11 14 41

Environment Information

  • OS: latest public macOS

  • Terminal Emulator: iTerm2 with zsh and zprezto plugin

  • Node Version: LTS

Steps to Reproduce

  const header = [
    {
      value: 'Test',
      align: 'left',
      headerAlign: 'left',
      footerAlign: 'right',
    },
    {
      value: 'Score',
      align: 'left',
      headerAlign: 'left',
      footerAlign: 'left',
      formatter: (cellValue) => {
        return cellValue > 60 ? green(cellValue) : red(cellValue)
      },
    },
  ]
  const rows = [
    ['Performance', 64],
    ['Accessibility', 70],
    ['Best Practices', 30],
    ['SEO', 60],
    ['PWA', 100],
  ]
  const footer = [
    'Total',
    (cellValue, columnIndex, rowIndex, rowData) => {
      const total = Math.round(rowData.map((i) => i[1]).reduce((p, c) => p + c) / 5)
      return italic(total)
    },
  ]
  const renderedTable = Table(header, rows, footer).render()
  console.log(renderedTable)
@tecfu
Copy link
Owner

tecfu commented Dec 10, 2020

Thanks for reporting. Feel free to send me in a PR, otherwise it will be a little while before I get to this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants