Skip to content

Instantly share code, notes, and snippets.

View sajadabedi's full-sized avatar
🧃
Less is more

Sajjad sajadabedi

🧃
Less is more
View GitHub Profile
import { useEffect } from 'react';
export function useOutsideClick(containerRef, triggerRef, cb) {
function isOutsideClick(evt) {
if (
(containerRef.current !== null &&
containerRef.current.contains(evt.target)) ||
(triggerRef !== null && triggerRef.current.contains(evt.target))
) {
return cb({
@sajadabedi
sajadabedi / CustomFont.swift
Last active September 6, 2022 19:39 — forked from jimmyhillis/UIFont+CustomFont.swift
Custom font Swift
import UIKit
extension UIFont {
class func systemFontOfSize(size: CGFloat) -> UIFont {
return UIFont(name: "CustomFont-Regular", size: size)!
}
func lightSystemFontOfSize(size: CGFloat) -> UIFont {
return UIFont(name: "CustomFont-Light", size: size)!
}
func boldSystemFontOfSize(size: CGFloat) -> UIFont {