diff --git a/src/components/PopoutPanel.css b/src/components/PopoutPanel.css index 33ca52d..4d28463 100644 --- a/src/components/PopoutPanel.css +++ b/src/components/PopoutPanel.css @@ -11,6 +11,7 @@ transform: translateX(0); /* Ensure visibility by default */ transition: transform 0.3s ease-in-out; z-index: 1000; /* Ensures it is above other elements */ + box-sizing: border-box; /* Ensures padding is included in width calculation */ } .popout-panel.hidden { @@ -100,69 +101,39 @@ color: #666; } -/* Filter controls syling*/ -.filter-controls { - display: flex; - align-items: center; - gap: 20px; +/* Specific styles for Popout Panel */ +.popout-panel .filter-container { + display: block; + gap: 15px; + justify-content: center; + margin-bottom: 20px; } -.filter-controls input[type="radio"] { - margin-right: 5px; /* Make radio buttons closer to the label */ - vertical-align: middle; +.popout-panel .filter-group { + display: block; + gap: 5px; + padding-right: 20px; + padding-left: 20px; + padding-top: 20px; + padding-bottom: 20px; + box-sizing: border-box; } -.filter-controls label { +.popout-panel .filter-group label { font-size: 1rem; font-weight: 600; - margin-right: 10px; - display: inline-block; - vertical-align: middle; + margin-bottom: 2px; + white-space: nowrap; } -/* Adjust radio button alignment */ -.filter-controls label { - font-size: 1rem; - font-weight: 600; - margin-right: 10px; - display: inline-block; - vertical-align: middle; -} - -.filter-controls input[type="radio"] { - margin-right: 5px; /* Make radio buttons closer to the label */ - vertical-align: middle; -} - -/* Space between Tuition and Distance sliders */ -.slider-container { - display: flex; - justify-content: space-between; - margin-top: 20px; - gap: 30px; /* Add space between the sliders */ -} - -.slider-container input[type="range"] { - width: 45%; /* Allow equal width for both sliders */ - margin: 0; -} - -.range-labels { - display: flex; - justify-content: space-between; - font-size: 0.9rem; -} - -/* Style for the range slider to show min/max values */ -.range-slider-wrapper { - display: flex; - justify-content: space-between; +.popout-panel .filter-group input[type="range"] { width: 100%; + box-sizing: border-box; } -/* Space between Tuition and Distance sliders */ -.range-slider-wrapper input { - width: 48%; /* Make both sliders occupy 48% space to leave space between them */ +.popout-panel .range-labels { + display: flex; + font-size: 0.9rem; } /* Schools section: Grid layout with clear separation */ diff --git a/src/components/PopoutPanel.js b/src/components/PopoutPanel.js index fe12602..1e28aad 100644 --- a/src/components/PopoutPanel.js +++ b/src/components/PopoutPanel.js @@ -17,8 +17,8 @@ function PopoutPanel({ const [loadingCalculation, setLoadingCalculation] = useState(false); const [persistedROI, setPersistedROI] = useState({}); const [sortBy, setSortBy] = useState('tuition'); // Default sorting - const [tuitionRange, setTuitionRange] = useState([0, 50000]); - const [distanceRange, setDistanceRange] = useState([0, 200]); + const [maxTuition, setMaxTuition] = useState(50000); // Set default max tuition value + const [maxDistance, setMaxDistance] = useState(200); // Set default max distance value const { jobDescription = null, @@ -32,7 +32,7 @@ function PopoutPanel({ useEffect(() => { setResults([]); setIsCalculated(false); - }, [sortBy, tuitionRange, distanceRange]); + }, [sortBy, maxTuition, maxDistance]); if (!isVisible) return null; @@ -65,20 +65,13 @@ function PopoutPanel({ /** 🔹 Apply Sorting & Filtering Directly at Render Time **/ const filteredAndSortedSchools = [...schools] - .filter(school => { - // Convert tuition to a number + .filter(school => { const inStateCost = parseFloat(school['In_state cost']); - - // Remove " mi" from distance and convert it to a number const distance = parseFloat(school['distance'].replace(' mi', '')); - - console.log(`Filtering School: ${school['INSTNM']} | Tuition: ${inStateCost} | Distance: ${distance}`); - + return ( - inStateCost >= tuitionRange[0] && - inStateCost <= tuitionRange[1] && - distance >= distanceRange[0] && - distance <= distanceRange[1] + inStateCost <= maxTuition && + distance <= maxDistance ); }) .sort((a, b) => { @@ -153,63 +146,49 @@ function PopoutPanel({ {/* Sorting & Filtering UI */} -
-
- - setSortBy('tuition')} - /> Tuition - setSortBy('distance')} - /> Distance + {/* Sorting UI */} +
+
+ +
- - setTuitionRange([Number(e.target.value), tuitionRange[1]])} - /> - setTuitionRange([tuitionRange[0], Number(e.target.value)])} - /> +
+ + setMaxTuition(Number(e.target.value))} + /> + {`$0 - $${maxTuition.toLocaleString()}`} +
- - setDistanceRange([Number(e.target.value), distanceRange[1]])} - /> - setDistanceRange([distanceRange[0], Number(e.target.value)])} - /> +
+ + setMaxDistance(Number(e.target.value))} + /> + {`${maxDistance} mi`} +
- {/* Schools Offering Programs Section */}

Schools Offering Programs