Skip to content

Instantly share code, notes, and snippets.

View sadewole's full-sized avatar
🎯
CREATOR

Samador sadewole

🎯
CREATOR
View GitHub Profile
@sadewole
sadewole / app.css
Created July 6, 2021 10:46
map container styling
.map-container {
width: 100%;
height: 500px;
border-radius: 5px;
}
@sadewole
sadewole / GenerateMap.js
Last active July 6, 2021 11:03
geocoding
const fetchData = useCallback(() => {
const geocodingClient = mbxGeocoding({
accessToken: mapboxgl.accessToken,
});
// geocoding with countries
return geocodingClient
.forwardGeocode({
query: 'Ikeja, Lagos',
countries: ['ng'],
@sadewole
sadewole / app.css
Created July 6, 2021 10:50
marker styling
/* Marker */
.marker {
height: 15px;
width: 15px;
border-radius: 50%;
background-color: blue;
cursor: pointer;
}
@sadewole
sadewole / GenerateMap.js
Last active July 6, 2021 23:35
Re-center map
useEffect(() => {
if (!map.current) return; // Waits for the map to initialise
const results = fetchData();
results.then((marker) => {
// create a HTML element for each feature
var el = document.createElement('div');
el.className = 'marker';
@sadewole
sadewole / index.html
Created July 6, 2021 11:18
HTML page
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Create a React app that uses Mapbox GL JS and Mapbox forward geocoding."
@sadewole
sadewole / App.js
Created July 6, 2021 13:07
Render GenerateMap.js into App.js
import logo from './logo.svg';
import './App.css';
import Mapbox from './components/GenerateMap';
function App() {
return (
<div className='App'>
<header className='App-header'>
<img src={logo} className='App-logo' alt='logo' />
<p>
@sadewole
sadewole / Tabs.vue
Created December 11, 2021 19:46
Tabs.vue - template
<template>
<div class="tabs">
<div class="tabs__list">
<slot />
</div>
<div class="tabs__overlay" />
</div>
</template>
@sadewole
sadewole / Tabs.vue
Created December 11, 2021 19:48
Tabs.vue - script
<script>
import { watch, ref, provide, defineComponent } from "vue";
export default defineComponent({
name: "Tabs",
props: {
groupName: { type: String, required: true },
initialTab: { type: String, required: true },
},
emits: ["change"],
@sadewole
sadewole / Tabs.vue
Created December 11, 2021 21:17
Tabs.vue - Styles
<style scoped>
.tabs {
display: inline-block;
position: relative;
box-sizing: border-box;
width: 100%;
height: 56px;
outline: none;
}
@sadewole
sadewole / Tab.vue
Created December 11, 2021 21:28
Tab.vue - script
<script lang="ts">
import { inject, defineComponent, Ref, ref } from "vue";
export default defineComponent({
name: "Tab",
props: {
value: { type: String, required: true },
label: { type: String, required: true },
},
setup() {