SelectMode.js 608 B

123456789101112131415161718192021222324252627282930
  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. return (
  21. <select value={value} onChange={e => onChange(e.target.value)}>
  22. {Object.entries(listObj).map(([value, text]) => (
  23. <option value={value} key={value}>
  24. {text}
  25. </option>
  26. ))}
  27. </select>
  28. );
  29. };