28 lines
712 B
JavaScript
28 lines
712 B
JavaScript
import React from "react";
|
|
import PropTypes from "prop-types";
|
|
import { useSelector } from "react-redux";
|
|
|
|
export const PolochonSelect = ({ value, changeValue }) => {
|
|
const publicPolochons = useSelector((state) => state.polochon.public);
|
|
|
|
return (
|
|
<select
|
|
className="form-control"
|
|
value={value}
|
|
onChange={(e) =>
|
|
changeValue(e.target.options[e.target.selectedIndex].value)
|
|
}
|
|
>
|
|
{publicPolochons.map((polochon) => (
|
|
<option value={polochon.id} key={polochon.id}>
|
|
{polochon.name} ({polochon.url})
|
|
</option>
|
|
))}
|
|
</select>
|
|
);
|
|
};
|
|
PolochonSelect.propTypes = {
|
|
value: PropTypes.string,
|
|
changeValue: PropTypes.func.isRequired,
|
|
};
|