Skip to content

Instantly share code, notes, and snippets.

View iam-rohid's full-sized avatar
🏠
Working from home

Rohid iam-rohid

🏠
Working from home
View GitHub Profile
@iam-rohid
iam-rohid / SellerMap.tsx
Created May 10, 2023 14:20
Leaflet Seller Map Component with NextJS 13.4
"use client";
import L from "leaflet";
import "leaflet.markercluster";
import { useEffect, useRef } from "react";
import { range } from "@/utils/range";
import "leaflet.markercluster/dist/MarkerCluster.Default.css";
import "leaflet.markercluster/dist/MarkerCluster.css";
import "leaflet/dist/leaflet.css";
import {View, Text, StyleSheet, LayoutChangeEvent} from 'react-native';
import React, {useCallback, useState} from 'react';
import Animated, {
Extrapolate,
SharedValue,
interpolate,
runOnJS,
useAnimatedGestureHandler,
useAnimatedStyle,
useSharedValue,
@iam-rohid
iam-rohid / pakcage.json
Created August 1, 2022 06:06
Default Next.js with TypeScript & Tailwind CSS Package JSON File
{
"name": "<app-name>",
"version": "<app-version>",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
@iam-rohid
iam-rohid / globals.css
Last active August 1, 2022 06:03
TailwindCSS CSS Import
@tailwind base;
@tailwind components;
@tailwind utilities;
body {
@apply bg-white text-gray-900 dark:bg-gray-900 dark:text-gray-100;
}
html {
scroll-padding-top: 2rem;
@iam-rohid
iam-rohid / ColorScheme.tsx
Created August 1, 2022 05:58
ColorScheme React Context & Hook
import { ReactNode, useEffect } from "react";
import { createContext, FC, useCallback, useContext } from "react";
import { useLocalStorage } from "@src/hooks/useLocalStorage";
export type ColorScheme = "light" | "dark";
export type ColorSchemeContextType = {
colorScheme: ColorScheme;
toggleTheme: (scheme?: ColorScheme) => void;
};
import { useCallback, useEffect, useState } from "react";
const useMediaQuery = (
query: string,
onChange?: (event: MediaQueryListEvent) => void
) => {
const [state, setState] = useState(false);
const onMediaChange = useCallback(
(ev: MediaQueryListEvent) => {
import { useEffect, useState } from "react";
export type UseLocalStorageProps<T> = {
key: string;
value: T;
};
export type UseLocalStorageReturn<T> = [
state: T,
setState: (newState: T) => void
@iam-rohid
iam-rohid / nextjs.gitignore
Last active August 1, 2022 05:09
Next js gitignore
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage