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

[Question] How are buttons udated when there are mulitple inputs? #9

Open
noenik opened this issue Mar 28, 2023 · 0 comments
Open

[Question] How are buttons udated when there are mulitple inputs? #9

noenik opened this issue Mar 28, 2023 · 0 comments

Comments

@noenik
Copy link

noenik commented Mar 28, 2023

I'm trying to make my first extension, and I can't seem to figure out how to update the text on the button when I have multiple inputs.

I've used the clock extension as a template where the following code updates the button:

this.setValue({
  'clock-12h': moment().format('h:mm A'),
  'clock-24h': moment().format('HH:mm')
})

this seems to work fine as long as there is one input on the button as is the case with the clock extesion:

this.inputs = [
  {
    label: 'Display Time',
    value: 'clock-display-time',
    icon: 'clock',
    mode: 'custom-value',
    fontIcon: 'fas',
    color: '#1a1a1a',
    input: [
      {
        label: 'Select Clock Format',
        type: 'input:select',
        items: [
          { value: 'clock-12h', label: '12 Hour Format' },
          { value: 'clock-24h', label: '24 Hour Format' }
        ]
      }
    ]
  }
];

Now let's say I'd like to add a parameter, e.g. the timezone for which I'd like to display the time.

this.inputs = [
  {
    label: 'Display Time',
    value: 'clock-display-time',
    icon: 'clock',
    mode: 'custom-value',
    fontIcon: 'fas',
    color: '#1a1a1a',
    input: [
      {
        label: 'Select Clock Format',
        type: 'input:select',
        items: [
          { value: 'clock-12h', label: '12 Hour Format' },
          { value: 'clock-24h', label: '24 Hour Format' }
        ]
      },
      {
        label: 'Select Timezone',
        type: 'input:select',
        items: [
          // ... List of timezones omited for brevity
        ]
      }
    ]
  }
];

how should the input for this.setValue look in this case?

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

1 participant