This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*Here's how to use it*/ | |
import FancyRoute from "./components/Route/Route" | |
export default function App(){ | |
return ( | |
<Router> | |
<FancyRoute path="/" component={Home}/> | |
</Router> | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default function Home() { | |
return ( | |
<div> | |
<div className="relative items-center justify-center"> | |
<h1 className="p-4 text-2xl font-bold text-center text-gray-400 bg-gray-800"> | |
Choose Your Next Adventure | |
</h1> | |
All | |
<div className="container items-center mx-auto my-auto lg:flex"> | |
<div className="mx-8 my-12 bg-white rounded-lg shadow-md lg:m-4 hover:shadow-lg hover:bg-gray-100"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Container maxW={'3xl'}> | |
<Stack | |
as={Box} | |
textAlign={'center'} | |
spacing={{ base: 8, md: 14 }} | |
py={{ base: 20, md: 36 }}> | |
<Heading | |
fontWeight={600} | |
fontSize={{ base: '2xl', sm: '4xl', md: '6xl' }} | |
lineHeight={'110%'}> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { gql, useQuery } from '@apollo/client' | |
import InfiniteScroll from 'react-infinite-scroll-component' | |
import { FeedQuery, FeedQueryVariables } from './__generated__/index.generated' | |
const FEED_QUERY = gql` | |
query FeedQuery($first: Int, $after: ID) { | |
feed(first: $first, after: $after) { | |
edges { | |
cursor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Tab } from '@headlessui/react' | |
import clsx from 'clsx' | |
import React from 'react' | |
import { IconType } from 'react-icons/lib' | |
// Gist this | |
interface Navigation { | |
name: string | |
icon: IconType | React.ElementType | |
component: React.ReactNode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createContext, useContext, useEffect, useState } from 'react' | |
import { getUser, logout } from 'services/axios' | |
/** | |
* getUser() -> Helper function to fetch user information. (basically an axios call) | |
* logout() -> Helper function to logout users | |
*/ | |
const AuthContext = createContext() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import clsx from 'clsx' | |
import React, { useCallback, useEffect } from 'react' | |
import { useDropzone } from 'react-dropzone' | |
import { useFormContext } from 'react-hook-form' | |
import { HiOutlinePhotograph } from 'react-icons/hi' | |
import { Alert } from '../Alert' | |
interface FileInputProps | |
extends React.DetailedHTMLProps< | |
React.InputHTMLAttributes<HTMLInputElement>, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mongoose from 'mongoose' | |
import log from '../utils/logger' | |
/** | |
* @description - This function creates connection to the database with given options. | |
* Resolves to connection with DB or Failure with an error message | |
* */ | |
export const makeConnection = async () => { | |
await mongoose | |
.connect( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { NextFunction, Request, Response } from 'express' | |
import { BaseSchema } from 'yup' | |
import { MixedSchema } from 'yup/lib/mixed' | |
/** | |
* This middleware checks the req.body against an yup schema provided in it | |
* @example | |
* ``` | |
* validate(incomingRequestBody, incomingBodySchema) | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const signUpHandler: RequestHandler<{}, {}, SignUpBody> = async ( | |
req, | |
res | |
) => { | |
const { firstName, lastName, email, password } = req.body | |
const isAlreadyRegistered = await User.findOne({ | |
email, | |
}) | |
if (isAlreadyRegistered) { |
OlderNewer