Skip to content

Instantly share code, notes, and snippets.

View ryanbelke's full-sized avatar
💭
coding

Ryan Beke ryanbelke

💭
coding
  • Austin, Tx
View GitHub Profile
@ryanbelke
ryanbelke / signin.js
Created October 7, 2019 04:17
/pages/signin.js
/* /pages/signin.js */
import React, { useState, useEffect } from "react";
import Router from "next/router";
import {
Container,
Row,
Col,
Button,
Form,
@ryanbelke
ryanbelke / signup.js
Created October 7, 2019 04:14
/pages/signup.js
/* /pages/signup.js */
import React, { useState } from "react";
import {
Container,
Row,
Col,
Button,
Form,
@ryanbelke
ryanbelke / layout.js
Last active October 7, 2019 04:16
layout.js with to handle logged in users
/* /components/Layout.js */
import React from "react";
import Head from "next/head";
import Link from "next/link";
import { Container, Nav, NavItem } from "reactstrap";
//import HOC withAuthSync and logout method
//wrap page in withAuthSync to access token and user props
import { logout } from "../lib/auth";
@ryanbelke
ryanbelke / auth.js
Last active March 21, 2023 16:57
auth.js HOC, register, login functions
/* /lib/auth.js */
import { useEffect } from "react";
import Router from "next/router";
import Cookie from "js-cookie";
import axios from "axios";
const API_URL = process.env.API_URL || "http://localhost:1337";
//register a new user
@ryanbelke
ryanbelke / restaurants.js
Last active September 29, 2019 04:08
/pages/restaurants.js
/* /pages/restaurants.js */
import { useQuery } from "@apollo/react-hooks";
import { useRouter } from "next/router";
import { gql } from "apollo-boost";
import withData from "../lib/apollo";
import {
Button,
Card,
CardBody,
@ryanbelke
ryanbelke / index.js
Last active May 5, 2020 00:00
/pages/index.js
/* /pages/index.js */
import React, { useState } from "react";
import { Col, Input, InputGroup, InputGroupAddon, Row } from "reactstrap";
import RestaurantList from "../components/RestaurantList";
function Home() {
const [query, updateQuery] = useState("");
return (
<div className="container-fluid">
@ryanbelke
ryanbelke / index.js
Last active September 29, 2019 03:25
RestaurantList Index.js
/* components/RestaurantList/index.js */
import { useQuery } from "@apollo/react-hooks";
import { gql } from "apollo-boost";
import Link from "next/link";
import {
Card,
CardBody,
CardImg,
@ryanbelke
ryanbelke / server.js
Created November 11, 2018 04:50
server.js file for Heroku deployment
/* server.js */
const express = require("express");
const next = require("next");
const dev = process.env.NODE_ENV !== "production";
const app = next({ dev });
const handle = app.getRequestHandler();
app
@ryanbelke
ryanbelke / index.js
Last active November 10, 2018 04:10
<Card
style={{ width: "30%", margin: "0 10px" }}
className="h-100"
key={res._id}
>
<CardImg
top={true}
style={{ height: 250 }}
src={res.image.url}
/>
@ryanbelke
ryanbelke / index.js
Created October 21, 2018 01:27
index.js file for using defaultPage.js
/* /pages/index.js */
import RestaurantList from "../components/RestaurantList";
import React from "react";
import defaultPage from "../hocs/defaultPage";
import {
Alert,
Button,
Col,
Input,