Skip to content
Snippets Groups Projects
Poll.tsx 1.1 KiB
Newer Older
  • Learn to ignore specific revisions
  • Guilhem CARRON's avatar
    Guilhem CARRON committed
    import { Editor } from '@tinymce/tinymce-react'
    import React, { ChangeEvent } from 'react'
    import './poll.scss'
    
    interface PollProps {
      question: string
      link: string
      handleChange: (
        value: string,
        type: 'header' | 'quote' | 'question' | 'link'
      ) => void
    }
    const Poll: React.FC<PollProps> = ({
      question,
      link,
      handleChange,
    }: PollProps) => {
      const handleChangeLink = (e: ChangeEvent<HTMLInputElement>) => {
        handleChange(e.target.value, 'link')
    
    Guilhem CARRON's avatar
    Guilhem CARRON committed
    
    
      return (
        <div className="poll">
    
    Guilhem CARRON's avatar
    Guilhem CARRON committed
          <h2>Ajouter un sondage</h2>
          <p className="title">Question</p>
    
          <Editor
            init={{
              menubar: false,
              toolbar:
                'undo redo | bold italic underline | alignleft aligncenter alignright | code | ecolyoLink',
            }}
            value={question}
            onEditorChange={(newQuestion, editor) =>
              handleChange(newQuestion, 'question')
            }
          />
          <p className="title">Lien</p>
    
          <input
            type="text"
            className="input-dark"
    
    Guilhem CARRON's avatar
    Guilhem CARRON committed
            value={link}
            onChange={handleChangeLink}
    
          />
        </div>
      )
    }
    
    export default Poll