Skip to content

Commit

Permalink
[#88] refactor: connect map info to db
Browse files Browse the repository at this point in the history
  • Loading branch information
damla committed Apr 16, 2021
1 parent 2f506a0 commit 362db79
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
16 changes: 4 additions & 12 deletions components/map/map.component.tsx
Original file line number Diff line number Diff line change
@@ -1,34 +1,25 @@
import React, { CSSProperties, ReactElement, useEffect, useState } from 'react'
import React, { ReactElement, useEffect, useState } from 'react'

// import styles from './map.module.scss'
import styles from './map.module.scss'

import mapboxgl from 'mapbox-gl'

interface Props {
mapApi: string
id: string
width: number
height: number
coordinate: [number, number]
HTML: string
}

export default function Map ({
mapApi,
id,
width,
height,
coordinate,
HTML
}: Props
): ReactElement {
const [pageIsMounted, setPageIsMounted] = useState(false)

const style: CSSProperties = {
width,
height
}

mapboxgl.accessToken = mapApi

useEffect(() => {
Expand All @@ -53,8 +44,9 @@ export default function Map ({

return (
<div
style={{ marginTop: '4vh' }}
id={id}
style={style}
className={styles.map}
/>
)
}
11 changes: 11 additions & 0 deletions components/map/map.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@use "../../global/variables.scss" as variables;

.map {
height: 400px;
width: 400px;

@media only screen and (max-width: variables.$max-width-middleEnd) {
height: 300px;
width: 300px;
}
}
5 changes: 5 additions & 0 deletions interfaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ export interface ItemModel {
value: string
link: string
}
map: {
id: string
coordinate: [number, number]
HTML: string
}
}

export interface ContactModel {
Expand Down

0 comments on commit 362db79

Please sign in to comment.