Skip to content

Commit

Permalink
style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Prabhat Pal committed Feb 8, 2021
1 parent 15c0243 commit 033002d
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 9 deletions.
11 changes: 8 additions & 3 deletions src/components/AddPlaceMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ import { FC, useEffect, useRef, useState } from "react";
import ReactMapGL, { Marker, ViewState } from "react-map-gl";
import { IoLocationSharp } from "react-icons/io5";
import Map from "./ui/Map";
import { LOCAL_STORAGE_VIEWPORT, ViewportFullHeight, ViewportHalfHeight } from "src/consts";
import {
LOCAL_STORAGE_VIEWPORT,
ViewportFullHeight,
ViewportHalfHeight,
} from "src/consts";
import { useLocalStorage } from "src/hooks";
import { minWidthXl } from 'src/utils';
import { minWidthXl } from "src/utils";

interface IProps {
searchedViewport: ViewState;
Expand All @@ -18,6 +22,7 @@ const AddPlaceMap: FC<IProps> = ({ searchedViewport }) => {
zoom: 13,
});
const [viewport, setViewport] = useState<ViewState>(localViewport);
const isMinWidthXl = minWidthXl();

useEffect(() => {
setViewport({ ...searchedViewport, zoom: 13 });
Expand All @@ -28,7 +33,7 @@ const AddPlaceMap: FC<IProps> = ({ searchedViewport }) => {
<Map
viewport={viewport}
width="100%"
height={minWidthXl() ? ViewportFullHeight : ViewportHalfHeight}
height={isMinWidthXl ? ViewportFullHeight : ViewportHalfHeight}
minZoom={4}
maxZoom={18}
ref={mapRef}
Expand Down
3 changes: 2 additions & 1 deletion src/components/HomeMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const HomeMap: FC<IProps> = ({
zoom: 11,
}
);
const isMinWidthXl = minWidthXl();

useEffect(() => {
if (searchedViewport) {
Expand All @@ -63,7 +64,7 @@ const HomeMap: FC<IProps> = ({
<Map
viewport={viewport}
width="100%"
height={minWidthXl() ? ViewportFullHeight : ViewportHalfHeight}
height={isMinWidthXl ? ViewportFullHeight : ViewportHalfHeight}
minZoom={4}
maxZoom={15}
ref={(instance) => {
Expand Down
3 changes: 2 additions & 1 deletion src/components/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ const MenuItem: FC<IMenuItem> = ({
const Navbar = () => {
const { user, logout, authenticated } = useAuth();
const router = useRouter();
const isMinWidthMd = minWidthMd();

const closeAuthModal = () => {
router.push(urls.home);
Expand All @@ -76,7 +77,7 @@ const Navbar = () => {
<div className="flex justify-between items-center">
{authenticated && router.pathname === urls.home && (
<Button asLink href={urls.addPlace}>
{minWidthMd() ? "Add a new place" : <IoMdAdd />}
{isMinWidthMd ? "Add a new place" : <IoMdAdd />}
</Button>
)}

Expand Down
5 changes: 3 additions & 2 deletions src/components/ViewPlaceMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { IoLocationSharp } from "react-icons/io5";
import Link from "next/link";
import Map from "./ui/Map";
import { urls, ViewportFullHeight, ViewportHalfHeight } from "src/consts";
import { minWidthXl } from 'src/utils';
import { minWidthXl } from "src/utils";

interface IPlace {
id: string;
Expand All @@ -31,6 +31,7 @@ const ViewPlaceMap: FC<IProps> = ({
longitude: place.longitude,
zoom: 13,
});
const isMinWidthXl = minWidthXl();

useEffect(() => {
setViewport({ ...searchedViewport, zoom: 13 });
Expand All @@ -41,7 +42,7 @@ const ViewPlaceMap: FC<IProps> = ({
<Map
viewport={viewport}
width="100%"
height={minWidthXl() ? ViewportFullHeight : ViewportHalfHeight}
height={isMinWidthXl ? ViewportFullHeight : ViewportHalfHeight}
minZoom={4}
maxZoom={18}
ref={mapRef}
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/DropMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ const DropMenu: DropMenuFC<IDropMenuProps> = ({
animate={{ height: "auto", opacity: 1 }}
exit={{ height: 0, opacity: 0 }}
transition={{ duration: 0.15 }}
className="absolute overflow-hidden right-0 z-10 border rounded-md shadow-sm focus:outline-none bg-gray-800 border-gray-600"
className="absolute overflow-hidden right-0 z-20 border rounded-md shadow-sm focus:outline-none bg-gray-800 border-gray-600"
>
<RenderItems closeOnItemSelect={closeOnItemSelect}>
{children}
Expand Down
2 changes: 1 addition & 1 deletion styles/tailwind.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ body {
.mapboxgl-ctrl-bottom-right,
.mapboxgl-ctrl-top-left,
.mapboxgl-ctrl-top-right {
z-index: 0;
z-index: 0 !important;
}

1 comment on commit 033002d

@vercel
Copy link

@vercel vercel bot commented on 033002d Feb 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.