Skip to content

Instantly share code, notes, and snippets.

View yinkakun's full-sized avatar
🍊
Focusing

Yinka Adedire yinkakun

🍊
Focusing
View GitHub Profile
import { ClassValue, clsx } from 'clsx';
import { twMerge } from 'tailwind-merge';
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}
import { ClassValue, clsx } from 'clsx';
import { twMerge } from 'tailwind-merge';
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}
type ButtonProps = React.ComponentProps<'button'>;
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
import React from 'react';
type Props = React.ComponentProps<'input'> & {};
export const NumericInput = React.forwardRef<HTMLInputElement, Props>(
({ className, onChange, ...props }, forwardedRef) => {
const handleInput = (event: React.ChangeEvent<HTMLInputElement>) => {
const numericValue = event.currentTarget.value.replace(/[^0-9]/g, '');
event.currentTarget.value = numericValue;
if (onChange) {
/* GLOBALLY */
* {
-ms-overflow-style: none; /* Internet Explorer 10+ */
scrollbar-width: none; /* Firefox */
}
*::-webkit-scrollbar {
display: none; /* Safari and Chrome */
}
@yinkakun
yinkakun / is-mobile.ts
Created October 1, 2023 09:26
is mobile?
export function isAndroid(): boolean {
return (
typeof navigator !== 'undefined' && /android/i.test(navigator.userAgent)
);
}
export function isSmallIOS(): boolean {
return (
typeof navigator !== 'undefined' && /iPhone|iPod/.test(navigator.userAgent)
);
@yinkakun
yinkakun / react-types.ts
Created September 12, 2023 09:23
react-types.ts
// Type definitions for React 18.2
// Project: https://react.dev/
// Definitions by: Asana <https://asana.com>
// AssureSign <http://www.assuresign.com>
// Microsoft <https://microsoft.com>
// John Reilly <https://github.com/johnnyreilly>
// Benoit Benezech <https://github.com/bbenezech>
// Patricio Zavolinsky <https://github.com/pzavolinsky>
// Eric Anderson <https://github.com/ericanderson>
// Dovydas Navickas <https://github.com/DovydasNavickas>
export default function App() {
return (
<div
style={{
height: "100vh",
display: "flex",
alignItems: "center",
justifyContent: "space-around",
}}
>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
export interface CircularProgressProps {
progress: number;
size: number;
}
export const CircularProgress = ({ progress, size }: CircularProgressProps) => {
// Calculate the percentage of the size
const xPercentOfSize = (x: number) => (x / 100) * size;
const strokeWidth = xPercentOfSize(8);
@yinkakun
yinkakun / axios.ts
Last active February 6, 2025 09:26
next client auth with zustand, axios
import Axios from "axios";
import Router from "next/router";
const API_URL = process.env.NEXT_PUBLIC_API_URL;
export const axios = Axios.create({
baseURL: API_URL,
headers: {
"Content-Type": "application/json",
},