Skip to content

Instantly share code, notes, and snippets.

View DanielCeron-dc's full-sized avatar
🟣
Focusing

Daniel Cerón DanielCeron-dc

🟣
Focusing
View GitHub Profile
import React, { useState } from 'react';
const useWindow = (): {isMobile:boolean, isTablet:boolean, isDesktop:boolean} => {
const [isMobile, setIsMobile] = useState(false);
const [isTablet, setIsTablet] = useState(false);
const [isDesktop, setIsDesktop] = useState(true);
React.useEffect(() => {
@DanielCeron-dc
DanielCeron-dc / useForm.ts
Last active October 3, 2021 14:38
Custom hook to control forms with refs easily React-typescript
import { FormEvent } from "react";
export type IRef = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement| null;
interface Iresponse {
[key:string]: {
value: string;
valid: boolean;
}
@DanielCeron-dc
DanielCeron-dc / Button.module.css
Last active March 24, 2022 21:41
Custom Button React-typescript
/* the variables are in another gist CSS-VARIABLES */
.button {
background: var(--primary);
border: 1px solid var(--primary-dark);
color: white;
padding: 10px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
@DanielCeron-dc
DanielCeron-dc / input.module.css
Last active October 3, 2021 14:34
Custom Input React-typescript
.base {
position: relative;
width: 100%;
overflow: hidden;
}
.span {
position: absolute;
bottom: 5px;
left: 10px;