ShowSavedZones.tsx (1326B)
1 import React from "react"; 2 3 import { displayTime, friendlyStr, removeTimeZone } from "../../utils"; 4 5 import { HMSDMY } from "../../utils"; 6 7 import { IShowSavedTimezones } from "../../utils/interfaces"; 8 9 function ShowSavedZones({ 10 savedZones, 11 time, 12 }: IShowSavedTimezones): JSX.Element { 13 return ( 14 <> 15 <h3 className="mt-5 mb-3">Saved time zones</h3> 16 <ul className="list-group"> 17 {savedZones.map((zone) => ( 18 <li 19 className="list-group-item list-group-item-action" 20 key={zone} 21 style={{ cursor: "pointer" }} 22 > 23 <div className="row"> 24 <div className="col"> 25 <span className="h4">{friendlyStr(zone)}</span> 26 <br /> 27 <span> 28 {displayTime({ fmtStr: HMSDMY, time, timezone: zone })} 29 </span> 30 </div> 31 <div className="justify-content-center align-self-center col"> 32 <button 33 className="btn btn-danger float-right" 34 onClick={() => removeTimeZone(zone)} 35 type="button" 36 > 37 Remove 38 </button> 39 </div> 40 </div> 41 </li> 42 ))} 43 </ul> 44 </> 45 ); 46 } 47 48 export default ShowSavedZones;