Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion powerplants/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ function App() {
<MlNavigationTools mapId="map1" showZoomButtons={true} />
)}

{/*Problem: Bei Suche wird DataLayer ein zweites mal geladen und doppelt übereinander dargestellt*/}
<Routes>
<Route path={pathname + ":searchWord"} element={<DataLayer />} />
<Route path={pathname + ""} element={<DataLayer />} />
<Route path={pathname} element={<DataLayer />} />
</Routes>
</ThemeProvider>
</>
Expand Down
4 changes: 2 additions & 2 deletions powerplants/src/components/Legend.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ export default function Legend(props) {
style={
mediaIsMobile
? {
opacity: props.toShow.includes(el.fuel) ? 0.8 : 0.2,
opacity: props.toShow.includes(el.fuel) ? 0.95 : 0.5,
backgroundColor: "#353535",
color: "white",
justifyContent: "left",
width: 105,
height: 22,
}
: {
opacity: props.toShow.includes(el.fuel) ? 0.8 : 0.2,
opacity: props.toShow.includes(el.fuel) ? 0.95 : 0.5,
backgroundColor: "#353535",
color: "white",
justifyContent: "left",
Expand Down
111 changes: 45 additions & 66 deletions powerplants/src/components/extendLegend.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,75 +6,54 @@ import {
useMediaQuery,
IconButton,
} from "@mui/material/";
import ExpandLessIcon from "@mui/icons-material/ExpandLess";
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
import MenuIcon from "@mui/icons-material/Menu";
import Legend from "./Legend";

export default function ExtendLegend(props) {
const mediaIsMobile = useMediaQuery("(max-width:900px)");

const [extended, setExtended] = useState(false);

useEffect(()=>{
if(mediaIsMobile){
setExtended(false)
} else {
setExtended(true)
}
}, [mediaIsMobile])
const mediaIsMobile = useMediaQuery("(max-width:900px)");

const [extended, setExtended] = useState(!mediaIsMobile);

return (
<AppBar
position="fixed"
sx={{
borderStyle: "hidden",
backgroundColor: "#353535",
top: mediaIsMobile ? 70 : 90,
left: mediaIsMobile ? 4 : 20,
width: mediaIsMobile ? 105 : 200,
height: mediaIsMobile ? 48 : 75,
opacity: 0.8,
}}
>
<Grid container>
<Grid item xs={12}>
<Typography
sx={{
fontSize: mediaIsMobile ? "10px" : "20px",
textAlign: "center",
paddingTop: "10px",
}}
>
Fuel Types
</Typography>
</Grid>
<Grid item xs={12} display="flex" justifyContent={"center"}>
<IconButton
sx={{
color: "white",
textAlign: "center",
paddingTop: 0,
}}
onClick={() => setExtended(!extended)}
>
{extended ? (
<>
<ExpandLessIcon
fontSize={mediaIsMobile ? "small" : "large"}
></ExpandLessIcon>
</>
) : (
<ExpandMoreIcon
fontSize={mediaIsMobile ? "small" : "large"}
></ExpandMoreIcon>
return (
<AppBar
position="fixed"
sx={{
borderStyle: "hidden",
backgroundColor: "#353535",
top: mediaIsMobile ? 70 : 90,
left: mediaIsMobile ? 4 : 20,
width: mediaIsMobile ? 105 : 200,
height: mediaIsMobile ? 48 : 75,
opacity: 0.8,
}}
>
<Grid container>
<Grid item xs={12}>
<Typography
sx={{
fontSize: mediaIsMobile ? "10px" : "20px",
textAlign: "center",
paddingTop: "10px",
}}
>
Fuel Types
</Typography>
</Grid>
<Grid item xs={12} display="flex" justifyContent={"center"}>
<IconButton
sx={{
color: "white",
textAlign: "center",
paddingTop: 0,
}}
onClick={() => setExtended(!extended)}
>
<MenuIcon fontSize={mediaIsMobile ? "small" : "large"} />
</IconButton>
</Grid>
{extended && (
<Legend toShow={props.toShow} setToShow={props.setToShow} />
)}
</IconButton>
</Grid>
{extended && (
<Legend toShow={props.toShow} setToShow={props.setToShow} />
)}
</Grid>
</AppBar>
);
</Grid>
</AppBar>
);
}
Loading