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 { Slot, type AsChildProps } from "./slot.tsx" | |
type ButtonProps = AsChildProps< | |
React.ButtonHTMLAttributes<HTMLButtonElement> | |
> & { | |
style?: React.CSSProperties | |
className?: string | |
} | |
function Button({ asChild, ...props }: ButtonProps) { |
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 { type ReactNode } from 'react'; | |
interface GridProps { | |
children: ReactNode; | |
as?: keyof JSX.IntrinsicElements; | |
className?: string; | |
} | |
export default function Grid({ as = 'div', children, className }: GridProps) { | |
const Component = as; |
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 getRandomBool = (chance: number = 50): boolean => | |
Math.round(Math.random() * 100) >= chance; |
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
/*================================================== | |
= Bootstrap 3 Media Queries = | |
==================================================*/ | |
/*========== Mobile First Method ==========*/ | |
/* Custom, iPhone Retina */ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 type { ReactNode } from 'react'; | |
interface ConditionalWrapperProps { | |
condition: boolean; | |
wrapper: (children: ReactNode) => ReactNode; | |
children: ReactNode; | |
} | |
export default function ConditionalWrapper({ | |
condition, |
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
jest.mock('../path/to/hooks/useMyHook', () => ({ | |
__esModule: true, | |
default: jest.fn(() => ({ | |
isLoading: false | |
})) | |
})); | |
(useMyHook as jest.MockedFunction<any>).mockReturnValue({ isLoading: 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
# Aliases | |
# Commit handlers | |
alias ga="git commit --amend" | |
alias gam="git add . && git commit --amend" | |
alias gamp="gam && gpf" | |
alias gp="git push -u origin $(git symbolic-ref --short HEAD)" | |
alias gpu="git pull" | |
alias gr="git reset HEAD^" | |
alias gt="git add . && git commit -m \"TEMP\" --no-verify" |
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 getUniqueId(prefix: string, length: number = 8): string { | |
let result = `${prefix}-`; | |
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; | |
const charactersLength = characters.length; | |
let counter = 0; | |
while (counter < length) { | |
result = `${result}${characters.charAt(Math.floor(Math.random() * charactersLength))}`; |
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 useD3 = (renderChartFn: (el: any) => void, dependencies: any[]) => { | |
const ref = useRef<HTMLElement>(); | |
useEffect(() => { | |
if (!!ref.current) { | |
renderChartFn(d3.select(ref.current)); | |
} | |
return () => {}; | |
}, dependencies); |