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 { useEffect, useRef, useState } from 'react'; | |
import { clsx, formatTime } from '~/utils/utils'; | |
import * as Icon from './icons'; | |
import type { Song } from '~/models/song'; | |
type Props = { | |
songs: Array<Song>; | |
}; | |
export function AudioPlayer(props: Props) { |
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 React, { useState, useEffect } from 'react'; | |
import { SPagination } from './Pagination.styled'; | |
import { motion } from 'framer-motion'; | |
import usePathName from 'hooks/usePathName'; | |
import { useRouter } from 'next/router'; | |
//TODO animate pagination | |
const links: URLType[] = ['/', '/home', '/about', '/works', '/contact']; | |
function Pagination() { |
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 React, { useState } from 'react'; | |
import useMatchMedia from 'hooks/useMatchMedia'; | |
import { breakpoints } from 'Theme/breakpoints'; | |
type ThemeStateType = 'light' | 'dark' | 'contrast'; | |
export type MainContextType = { | |
theme: ThemeStateType; | |
setTheme: (value: ThemeStateType) => void; | |
medium: boolean; |
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
const Container = styled.header` | |
position: fixed; | |
top: 0; | |
height: 10%; | |
width: 100%; | |
display: grid; | |
grid-template-areas: 'social . nav .'; | |
grid-template-columns: 15% 1fr 1fr 15%; |
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 React from 'react'; | |
import styled from 'styled-components'; | |
import { ColorsType } from 'Theme/colors'; | |
import { icons, NameIconType } from './icons'; | |
/** | |
* Define Props for Icon component | |
*/ | |
type IconProps = { | |
/** |
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
/**============== Avoid doing things weird with never ===========================*/ | |
type Exact<A, B> = A extends B ? (B extends A ? A : never) : never; | |
// This basically says that if and A extends B and B extends A then the types are identical, | |
// neither are a subset or superset of the other. | |
// So it should allow that type through. | |
// If they are not identical, then the type is never which prevents that type from being allowed. | |
// Now you just need to make your function generic, and enforce that argument to exactly the right type: |
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
/// <reference types="styled-components" /> | |
import 'styled-components'; | |
import { DefaultTheme } from 'styled-components'; | |
export type ColorsThemeType = { | |
home: string; | |
about: string; | |
works: string; | |
contact: string; |
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 { useState, useEffect } from 'react'; | |
const useMatchMedia = (mediaQuery: string) => { | |
const [isMatches, setIsMatches] = useState( | |
window.matchMedia(mediaQuery).matches | |
); | |
useEffect(() => { | |
const updateStateisMatches = (event: MediaQueryListEvent) => | |
setIsMatches(event.matches); |
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 * as React from 'react'; | |
import styled from 'styled-components'; | |
import Routes from './Routes/Routes'; | |
import Header from './components/Header/Header'; | |
import Footer from './components/Footer/Footer'; | |
import Nav from './components/Nav/Nav'; |
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 checkErrorsInput = (name, value) => { | |
let errors = {}; | |
const options = { | |
isRequired: value.length === 0, | |
isInvalidName: value.length < 5, | |
isInvalidMessage: value.length < 15, | |
isInvalidMail: !/\S+@\S+\.\S+/.test(String(value).toLocaleLowerCase()), | |
isInvalidPhone: !/\b[\d]{10}\b/.test(value), | |
}; |
NewerOlder