Skip to content

Instantly share code, notes, and snippets.

View sabesansathananthan's full-sized avatar
:octocat:
Work

Sathananthan Sabesan sabesansathananthan

:octocat:
Work
View GitHub Profile
@sabesansathananthan
sabesansathananthan / App.js
Created April 30, 2020 03:16
How to use the Google Maps API with Custom styling in React.js
import React from "react";
import Maps from "./Maps";
function App() {
return <Maps />;
}
export default App;
@sabesansathananthan
sabesansathananthan / MarkerMaps.js
Created April 30, 2020 09:29
How to use the Google Maps API with Custom styling in React.js
export class Maps extends React.Component {
render() {
const mapStyles = {
width: "100%",
height: "100%",
};
return (
<Map
google={this.props.google}
zoom={8}
@sabesansathananthan
sabesansathananthan / GoogleMapStyles.js
Last active April 30, 2020 21:51
How to use the Google Maps API with Custom styling in React.js
export default {
mapStyle: [
{
elementType: "geometry",
stylers: [
{
color: "#ebe3cd",
},
],
},
@sabesansathananthan
sabesansathananthan / Maps.js
Created April 30, 2020 22:09
How to use the Google Maps API with Custom styling in React.js
import googleMapStyles from "./GoogelMapStyle";
export class Maps extends React.Component {
render() {
return (
<Map
google={this.props.google}
zoom={8}
style={this.props.mapStyle}
initialCenter={{ lat: 9.761927, lng: 79.95244 }}
@sabesansathananthan
sabesansathananthan / index.js
Last active September 16, 2020 19:03
Create a COVID-19 Tracker using React.js and Serverless Material UI Contact form
import React from "react";
import ReactDOM from "react-dom";
import App from "./App";
ReactDOM.render(<App />, document.getElementById("root"));
@sabesansathananthan
sabesansathananthan / index.js
Created June 16, 2020 15:40
Fetch Data from API for Create a COVID-19 Tracker using React.js
import axios from "axios";
const url = "https://covid19.mathdro.id/api";
export const fetchData = async (country) => {
let changeableUrl = url;
if (country) {
changeableUrl = `${url}/countries/${country}`;
}
@sabesansathananthan
sabesansathananthan / cards.jsx
Created June 16, 2020 16:44
Create a COVID-19 Tracker using React.js
import React from "react";
import { Card, CardContent, Typography, Grid } from "@material-ui/core";
import styles from "./Cards.module.css";
import CountUp from "react-countup";
import cx from "classnames";
const Cards = ({
data: { confirmed, recovered, deaths, lastUpdate },
country,
}) => {
@sabesansathananthan
sabesansathananthan / Cards.module.css
Created June 16, 2020 17:03
Create a COVID-19 Tracker using React.js
.container {
margin: 50px 0px;
}
.card {
margin: 0 2% !important;
}
.infected {
background-color: rgba(102, 179, 255, 0.5) !important;
@sabesansathananthan
sabesansathananthan / Chart.jsx
Created June 16, 2020 17:15
Create a COVID-19 Tracker using React.js
import React, { useState, useEffect } from "react";
import { fetchDailyData } from "../../api";
import { Line, Bar } from "react-chartjs-2";
import styles from "./Chart.module.css";
const Chart = ({ data: { confirmed, recovered, deaths }, country }) => {
const [dailyData, setDailyData] = useState([]);
useEffect(() => {
const fetchAPI = async () => {
setDailyData(await fetchDailyData());
@sabesansathananthan
sabesansathananthan / Chart.module.css
Created June 16, 2020 17:41
Create a COVID-19 Tracker using React.js
.container {
display: flex;
justify-content: center;
width: 85%;
}
@media (max-width: 770px) {
.container {
width: 100%;
}
.image {