This file contains hidden or 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
/* | |
* Stripe WebGl Gradient Animation | |
* All Credits to Stripe.com | |
* ScrollObserver functionality to disable animation when not scrolled into view has been disabled and | |
* commented out for now. | |
* https://kevinhufnagl.com | |
*/ | |
//Converting colors to proper format | |
function normalizeColor(hexCode) { |
This file contains hidden or 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
<Route path="/search" children={<Search />} /> | |
... | |
<Link to={`/search?category=${cat}&bundle=${bund}`}>Search</Link> | |
... | |
let location = useLocation(); | |
console.log(location) | |
/* | |
{ | |
pathname: '/search', |
This file contains hidden or 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
function userPermission({ userID: string }) { | |
const res = await fetch(`https://api.amazon.com/user/${userID}`); | |
const userPermission = await res.json(); | |
localStorage.setItem("userPermission", JSON.stringify(userPermission)); | |
} |
This file contains hidden or 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 DeliveryForm() { | |
const { register, handleSubmit, formState: { errors } } = useForm(); | |
const onSubmit = data => console.log(data); | |
return ( | |
<form onSubmit={handleSubmit(onSubmit)}> | |
<input placeholder="Full Name" {...register("fullName")} /> | |
<input placeholder="Delivery Address" {...register("deliveryAddress", { required: true })} /> |
This file contains hidden or 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
function ProductList() { | |
const getProducts = async () => { | |
const res = await fetch("https://api.amazon.com/products"); | |
const products = await res.json(); | |
return products; | |
}; | |
const { data, isLoading, isError, error } = useQuery("productList", getProducts); | |
if (isLoading) return "Loading..."; |
This file contains hidden or 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 { createSlice, PayloadAction } from '@reduxjs/toolkit' | |
export interface OrderState { | |
item: string; | |
qty: number; | |
total: number; | |
} | |
const initialState: OrderState = { | |
item: "", |
This file contains hidden or 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
const puppeteer = require('puppeteer'); | |
async function getPic() { | |
const browser = await puppeteer.launch(); | |
const page = await browser.newPage(); | |
await page.goto('http://courseweb.sliit.lk'); | |
await page.screenshot({path: 'courseweb.png'}); | |
await browser.close(); | |
} |