Skip to content

Instantly share code, notes, and snippets.

View GeoffMahugu's full-sized avatar
:octocat:
Fullstack Software Developer | DevOps Engineer

Geoffrey Mahugu GeoffMahugu

:octocat:
Fullstack Software Developer | DevOps Engineer
View GitHub Profile
import React from 'react';
import { Link } from 'react-router-dom';
import IPageProps from '../interfaces/page.interface';
const SignUpPage: React.FunctionComponent<IPageProps> = props => {
return (
<div>
<h1> SignUp Page - Unprotected</h1>
<Link to={`/`}>
<button>Back Home</button>
@GeoffMahugu
GeoffMahugu / CartPage.tsx
Last active May 20, 2021 13:13
This is a react typescript CartPage
import React from 'react';
import { Link } from 'react-router-dom';
import IPageProps from '../interfaces/page.interface';
const CartPage: React.FunctionComponent<IPageProps> = props => {
return (
<div>
<h1> Cart Page - Protected</h1>
<Link to={`/`}>
<button>Back Home</button>
@GeoffMahugu
GeoffMahugu / HomePage.tsx
Last active May 20, 2021 13:18
This is a react component page using Page interface
import React from 'react';
import { Link } from 'react-router-dom';
import IPageProps from '../interfaces/page.interface';
const HomePage: React.FunctionComponent<IPageProps> = props => {
return (
<div>
<h1> Home Page - Unprotected</h1>
<Link to={`/cart`}>
<button>View Cart</button>
@GeoffMahugu
GeoffMahugu / page.interface.ts
Created May 15, 2021 17:37
This is a react page interface
export default interface IPageProps {
name: string;
}
@GeoffMahugu
GeoffMahugu / HomePage.tsx
Last active May 20, 2021 13:19
This is the init home page for react-firebase project
import React from 'react';
import { Link } from 'react-router-dom';
interface IPageProps {
name: string;
}
const HomePage: React.FunctionComponent<IPageProps> = props => {
return (
<div>
<h1> Home Page - Unprotected</h1>
@GeoffMahugu
GeoffMahugu / firebase.ts
Created May 15, 2021 13:39
This is react firebase configuration file
import firebase from 'firebase/app';
import 'firebase/auth';
import config from './config';
const Firebase = firebase.initializeApp(config.firebase);
// Add or Remove authentification methods here.
export const Providers = {
google: new firebase.auth.GoogleAuthProvider(),
facebook: new firebase.auth.FacebookAuthProvider(),
@GeoffMahugu
GeoffMahugu / cofig.ts
Last active May 15, 2021 13:29
This is a react config file containing firebase credentials from memory.
// Contains Global Configurations
const config = {
firebase: {
apiKey: process.env.REACT_APP_FIREBASE_KEY,
authDomain: process.env.REACT_APP_FIREBASE_DOMAIN,
databaseURL: process.env.REACT_APP_FIREBASE_DATABASE,
projectId: process.env.REACT_APP_FIREBASE_PROJECT_ID,
storageBucket: process.env.REACT_APP_FIREBASE_STORAGE_BUCKET,
messagingSenderId: process.env.REACT_APP_FIREBASE_SENDER_ID,
appId: process.env.REACT_APP_FIREBASE_APP_ID,
@GeoffMahugu
GeoffMahugu / react-firebase.env
Created May 15, 2021 13:18
This is the .env file for firebase credentials file
## Firebase Credentials
REACT_APP_FIREBASE_KEY=""
REACT_APP_FIREBASE_DOMAIN=""
REACT_APP_FIREBASE_DATABASE=""
REACT_APP_FIREBASE_PROJECT_ID=""
REACT_APP_FIREBASE_STORAGE_BUCKET=""
REACT_APP_FIREBASE_SENDER_ID=""
REACT_APP_FIREBASE_APP_ID=""
REACT_APP_FIREBASE_MEASUREMENT_ID=""
@GeoffMahugu
GeoffMahugu / schema.js
Last active April 12, 2021 18:37
This is a schema file for a GraphQL application to perform CRUD operations on a Product.
const { buildSchema } = require('graphql');
export default buildSchema(`
type Product{
_id:ID!
name: String!
description: StriWng!
price: Float!
discount: Int
created_at: String!
@GeoffMahugu
GeoffMahugu / resolvers.js
Last active April 12, 2021 18:27
This is a CRUD resolver for a product written in GraphQL
const Product = require('../models/product');
module.exports = {
/**
* CREATE PRODUCT -
* @param { name, description, price, discount} ProductInput
* @returns Product
*
* @mutation
* mutation {