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 { useCallback, useEffect, useState, useRef } from "react"; | |
/** | |
* MobileSwiper component for handling touch swipe gestures on mobile devices. | |
* | |
* @component | |
* @param {Object} props - React component props | |
* @param {ReactNode} props.children - The content to be wrapped by the swiper | |
* @param {function} props.onSwipe - Callback function triggered on swipe with an object containing deltaX and deltaY | |
* @returns {JSX.Element} - React component |
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
.board { | |
position: relative; | |
width: calc(var(--pixel-size) * 8 * 4 + var(--pixel-size) * 5); | |
} | |
.grid { | |
display: flex; | |
flex-wrap: wrap; | |
background: var(--secondary-background); | |
border: calc(var(--pixel-size) * 0.5) solid var(--secondary-background); |
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
.board { | |
position: relative; | |
width: calc(var(--pixel-size) * 8 * 4 + var(--pixel-size) * 5); | |
} | |
.grid { | |
display: flex; | |
flex-wrap: wrap; | |
background: var(--secondary-background); | |
border: calc(var(--pixel-size) * 0.5) solid var(--secondary-background); |
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
.score { | |
width: var(--pixel-size) * 75; | |
background: var(--secondary-background); | |
border: var(--pixel-size) solid var(--secodary-background); | |
border-radius: calc(var(--pixel-size) * 0.75); | |
color: var(--tile-background); | |
font-weight: bold; | |
font-size: calc(var(--pixel-size) * 2); | |
text-align: center; | |
text-transform: uppercase; |
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
if (process.env.NODE_ENV !== 'production') { | |
// your unfinished code. | |
} |
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 { Matchers } from '@pact-foundation/pact'; | |
import fetchJob from '../fetchJob'; | |
describe('Services', () => { | |
beforeAll(() => provider.setup()); | |
afterAll(() => provider.finalize()); | |
describe('fetchJob', () => { |
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
/** | |
* @param {string} string | |
* @param {RegExp} pattern | |
*/ | |
export default function split(string:string, pattern: RegExp):Array<string> { | |
return string.match(pattern) || []; | |
} |
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 { curryRight, flow, join } from "lodash"; | |
import split from "./split"; | |
import reverse from "./reverse"; | |
/** | |
* Thousand Regular Expression | |
*/ | |
const thousandRegExp:RegExp = /[0-9]{1,3}/g; |
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
// without immutable | |
initialState.numbers = numbers.filter((num:number):boolean => { | |
return num % 2 === 0; | |
}) | |
console.log('after update:', initialState); | |
// after update: { numbers: [ 2, 4, 6 ] } |
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
type State = { | |
numbers: Array<number>; | |
} | |
const initialState:State = { | |
numbers: [1, 2, 3, 4, 5, 6] | |
}; | |
const { numbers } = initialState; |
NewerOlder