EnCiv/enciv-home

Have a question at bottom of faq

Closed this issue · 1 comments

fix up app/components/have-a-question and use it in app/components/frequently-asked-questions at the bottom to allow the user to ask a question and send it in.

The module works, but it needs to be formatted to look right.

See example at bottom of https://cc.enciv.org/undebates

In the faq story, you will need something like this to test send-contact-us: WARNING - NOT TESTED

export const FrequentlyAskedQuestionsTest={
    args: { faqs },
    decorators: [
      Story => {
      // simulate socket api
        if (!window.socket) {
          window.socket = {
            emit: (handle, email, fname, lname, subject, message, cb) => {
            if (handle !== 'send-contact-us') console.error('emit expected send-contact-us, got:', handle)
            if (email === 'success@email.com') setTimeout(() => cb({ error: '' }), 1000)
            else setTimeout(() => cb({ error: 'somethings wrong' }), 1000)
         },
       }
      return <Story />
    },
  ],
}

Also, all the storied in there can eliminate the Template and just set args like this. It's a newer pattern in storybook that saves code.

@ddfridley I would like to try this