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 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" | |
> |
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 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" | |
> |
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 styled from "styled-components"; | |
const S = {}; | |
S.CarouselItem = styled.div` | |
padding: 0.5rem 0; | |
border-bottom: solid 1px; | |
img { | |
width: 100%; | |
height: 100%; |
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 { useState } from "react"; | |
import styled from "styled-components"; | |
import { useSpringCarousel } from "react-spring-carousel-js"; | |
import CarouselItem from "./CarouselItem"; | |
import ArrowButton from "./ArrowButton"; | |
import { S as StyledArrowButton } from "./ArrowButton"; | |
const S = {}; | |
S.Carousel = styled.div` |
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 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; | |
`; |
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 asyncTryCatch = async (tryer) => { | |
try { | |
const data = await tryer(); | |
return [data, null]; | |
} catch (error) { | |
return [null, error]; | |
} | |
}; | |
export default async function (req: NextApiRequest, res: NextApiResponse) { |
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 { useRef, useEffect, useState } from "react"; | |
export default function Test() { | |
const [height, setHeight] = useState(0); | |
const ref = useRef<HTMLDivElement>(null); | |
useEffect(() => { | |
if (ref.current) { | |
setHeight((ref.current.clientWidth * 16) / 9); | |
} |
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 styled from '@emotion/styled' | |
import Image from 'next/image' | |
import { useProgressiveImage } from 'src/hooks/useProgressiveImage' | |
export function BlurredUpImage({ tiny, large, width, height, alt }) { | |
const [src, { blur }] = useProgressiveImage(tiny, large) | |
return <StyledImage src={src} width={width} height={height} alt={alt} blur={blur} /> | |
} | |
const StyledImage = styled(Image)` |
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
# Command to check git default line ending: | |
# if true, it will auto-convert line endings. Windows => crlf, Linux/MAC => lf | |
`git config --global --get core.autocrlf` | |
# Command to update git default line ending | |
# will always be the same as in the repo. VSCode is smart enough to understand crlf and lf line endings. | |
`git config --global core.autocrlf false` | |
# Add ssh key/passphrase to ssh-agent so I can log into SSH servers without having to type passphrase every time | |
ssh-add ~/.ssh/id_rsa |