source: imaps-frontend/src/components/Modals/Components/ModalSelectConnections2.jsx@ 0c6b92a

main
Last change on this file since 0c6b92a was 0c6b92a, checked in by stefan toskovski <stefantoska84@…>, 5 weeks ago

Pred finalna verzija

  • Property mode set to 100644
File size: 1.6 KB
Line 
1import styles from "../EntranceModal/EntranceModal.module.css";
2import React from "react";
3import PropTypes from "prop-types";
4import MapShape from "../../../scripts/base/MapShape.js";
5
6export default function ModalSelectConnections2({shapeInfo,updateModalData,addConnection,availableShapes}) {
7
8 console.log("shapes modal",availableShapes)
9 return (
10 <div className={styles.formGroup}>
11 <label htmlFor="selectedPin">Select connections:</label>
12 <select
13 id="selectedPin"
14 name="selectedPin"
15 value={shapeInfo.selectedPin}
16 onChange={updateModalData}
17 >
18 <option value="">Select Connection</option>
19 {availableShapes
20 .filter(
21 (s) =>
22 !s.info.selectedPins.includes(shapeInfo.name) &&
23 s.info.name !== "" &&
24 s.info.name !== shapeInfo.name
25 )
26 .map((othShape, index) => (
27 <option key={index} value={othShape.info.name}>
28 {othShape.info.name}
29 </option>
30 ))}
31 </select>
32 <button type="button" onClick={addConnection} className={styles.addButton}>
33 Add Connection
34 </button>
35 </div>
36 )
37}
38
39ModalSelectConnections2.propTypes = {
40 shapeInfo: PropTypes.object,
41 updateModalData: PropTypes.func,
42 addConnection: PropTypes.func,
43}
Note: See TracBrowser for help on using the repository browser.