SelectMode.js 681 B

123456789101112131415161718192021222324252627
  1. const types = {
  2. html: "html",
  3. css: "css",
  4. javascript: "javascript",
  5. java: "java",
  6. python: "python",
  7. ruby: "ruby",
  8. xml: "xml",
  9. sass: "sass",
  10. json: "json",
  11. typescript: "typescript",
  12. markdown: "markdown",
  13. mysql: "mysql",
  14. handlebars: "handlebars",
  15. golang: "golang",
  16. csharp: "csharp",
  17. elixir: "elixir"
  18. }
  19. export const SelectMode = ({listObj=types, onChange, value}) =>
  20. {
  21. return <select value = {value} onChange={e => onChange(e.target.value)}>
  22. {Object.entries(listObj).map(([value, text]) => <option value={value} key={value}>
  23. {text}
  24. </option>)}
  25. </select>
  26. }