Skip to content

Commit 3cf069a

Browse files
fixed map (#629)
1 parent d39f7e2 commit 3cf069a

File tree

9 files changed

+5990
-5499
lines changed

9 files changed

+5990
-5499
lines changed

env.local

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
NEXT_PUBLIC_GOOGLE_ANALYTICS_ID=G-WSXY307CRR
2+
NEXT_PUBLIC_GOOGLE_MAPS_KEY=AIzaSyB3mMuvl8IUlviRZiizBiX7uhsdIqunx94

env.production

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
NEXT_PUBLIC_GOOGLE_ANALYTICS_ID=G-WSXY307CRR
2+
NEXT_PUBLIC_GOOGLE_MAPS_KEY=AIzaSyB3mMuvl8IUlviRZiizBiX7uhsdIqunx94

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"@playwright/test": "^1.37.1",
5757
"@tailwindcss/typography": "^0.5.2",
5858
"@types/cookie": "^0.5.1",
59-
"@types/google.maps": "^3.49.1",
59+
"@types/google.maps": "^3.58.1",
6060
"@types/jsonwebtoken": "^8.5.8",
6161
"@types/marked": "^4.0.3",
6262
"@types/node": "^18.0.0",

src/components/ui/google-map/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ type MapProps = google.maps.MapOptions;
1111
const MyMap: React.FC<MapProps> = ({ ...options }) => {
1212
return (
1313
<Wrapper
14-
apiKey="AIzaSyB3mMuvl8IUlviRZiizBiX7uhsdIqunx94"
14+
apiKey={process.env.NEXT_PUBLIC_GOOGLE_MAPS_KEY || ''}
1515
render={render}
1616
>
1717
<Map {...options}>
18-
<Marker position={options.center} />
18+
{options.center && <Marker position={options.center} />}
1919
</Map>
2020
</Wrapper>
2121
);
2222
};
2323

24-
export default MyMap;
24+
export default MyMap;

src/containers/contact-info/layout-02/index.tsx

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,13 @@ type TProps = TSection & {
1616
};
1717
};
1818

19-
const ContactInfo = ({ data: { section_title, items, location } }: TProps) => {
19+
const ContactInfo = ({ data: { section_title, items } }: TProps) => {
20+
// Hardcoded Atlanta coordinates
21+
const atlantaLocation = {
22+
latitude: 33.7488,
23+
longitude: -84.3877
24+
};
25+
2026
return (
2127
<Section className="contact-info-area" space="none">
2228
<div className="tw-container">
@@ -61,26 +67,24 @@ const ContactInfo = ({ data: { section_title, items, location } }: TProps) => {
6167
</div>
6268
))}
6369
</motion.div>
64-
{location && (
65-
<motion.div
66-
className="tw-h-[300px] lg:tw-h-[400px]"
67-
initial="offscreen"
68-
whileInView="onscreen"
69-
viewport={{ once: true, amount: 0.4 }}
70-
variants={scrollUpVariants}
71-
>
72-
<GoogleMap
73-
center={{
74-
lat: location.latitude,
75-
lng: location.longitude,
76-
}}
77-
zoom={14}
78-
/>
79-
</motion.div>
80-
)}
70+
<motion.div
71+
className="tw-h-[300px] lg:tw-h-[400px]"
72+
initial="offscreen"
73+
whileInView="onscreen"
74+
viewport={{ once: true, amount: 0.4 }}
75+
variants={scrollUpVariants}
76+
>
77+
<GoogleMap
78+
center={{
79+
lat: atlantaLocation.latitude,
80+
lng: atlantaLocation.longitude,
81+
}}
82+
zoom={14}
83+
/>
84+
</motion.div>
8185
</div>
8286
</Section>
8387
);
8488
};
8589

86-
export default ContactInfo;
90+
export default ContactInfo;

src/utils/types.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
/// <reference types="@types/google.maps" />
2+
3+
declare global {
4+
interface Window {
5+
google: typeof google;
6+
}
7+
}
8+
9+
// Google Maps Types
10+
export interface MapType extends google.maps.MapOptions {
11+
onClick?: (e: google.maps.MapMouseEvent) => void;
12+
children?: React.ReactNode;
13+
}
14+
15+
export interface MarkerType extends google.maps.MarkerOptions {
16+
onClick?: () => void;
17+
}
18+
119
export type IDType = string | number;
220

321
export interface ImageType {

tsconfig.json

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,17 @@
3232
"@utils/*": ["utils/*"],
3333
"@widgets/*": ["components/widgets/*"],
3434
"@fonts/*": ["public/fonts/*"]
35-
}
35+
},
36+
"types": ["google.maps"] // Add this line
3637
},
37-
"include": ["next-env.d.ts", "next.config.js", "src/**/*.ts", "src/**/*.tsx", "tailwind.config.js", "postcss.config.js", "next-sitemap.config.js"],
38+
"include": [
39+
"next-env.d.ts",
40+
"next.config.js",
41+
"src/**/*.ts",
42+
"src/**/*.tsx",
43+
"tailwind.config.js",
44+
"postcss.config.js",
45+
"next-sitemap.config.js"
46+
],
3847
"exclude": ["node_modules"]
39-
}
48+
}

0 commit comments

Comments
 (0)