Skip to content

Instantly share code, notes, and snippets.

View DonHuskini's full-sized avatar
🏠
Working from home

Don Huskini DonHuskini

🏠
Working from home
View GitHub Profile
@DonHuskini
DonHuskini / async-try-catch-snippet-03.js
Last active May 8, 2021 14:50 — forked from jmaicaaan/try-catch-snippet-03.js
[Tutorial] Functional try catch
const asyncTryCatch = async (tryer) => {
try {
const data = await tryer();
return [data, null];
} catch (error) {
return [null, error];
}
};
export default async function (req: NextApiRequest, res: NextApiResponse) {
import styled from "styled-components";
import ProductList from "./components/products/ProductList";
import items from "./assets/items.json";
const S = {};
S.Container = styled.div`
max-width: 800px;
margin: 0 auto;
`;
import styled from "styled-components";
const S = {};
S.CarouselItem = styled.div`
padding: 0.5rem 0;
border-bottom: solid 1px;
img {
width: 100%;
height: 100%;
import styled from "styled-components";
import LeftArrow from "../icons/LeftArrow";
import RightArrow from "../icons/RightArrow";
export const S = {};
S.ArrowButton = styled.button`
background-color: transparent;
border: none;
position: absolute;
z-index: 999;
const RightArrow = () => {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
width="2rem"
height="2rem"
fill="currentColor"
class="bi bi-arrow-right-short"
viewBox="0 0 16 16"
>
const LeftArrow = () => {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
width="2rem"
height="2rem"
fill="currentColor"
class="bi bi-arrow-left-short"
viewBox="0 0 16 16"
>
import styled from "styled-components";
import Product from "./Product";
const S = {};
S.ProductList = styled.div`
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-gap: 1em;
`;
import styled from "styled-components";
import Carousel from "./../carousel/Carousel";
const S = {};
S.Product = styled.div`
border: solid 1px;
font-size: 1.25rem;
`;
S.Details = styled.div`
[
{
"id": 1,
"name": "Leopard Gaming Chair, High Back PU Leather Office Chair - Black/Blue",
"price": 189.99,
"images": [
"https://images-na.ssl-images-amazon.com/images/I/61vKfuN%2B8TL._AC_SL1500_.jpg",
"https://images-na.ssl-images-amazon.com/images/I/617ue%2BHuTwL._AC_SL1500_.jpg",
"https://images-na.ssl-images-amazon.com/images/I/71-UcCz9zoL._AC_SL1500_.jpg",
"https://images-na.ssl-images-amazon.com/images/I/71Jq7Z11E6L._AC_SL1500_.jpg",