Skip to content

Instantly share code, notes, and snippets.

@dashmedialtd
dashmedialtd / settings.json
Created April 17, 2024 15:00
VS Code Config
// To be added into .vscode/settings.json
{
"tailwindCSS.rootFontSize": 17,
"tailwindCSS.experimental.classRegex": ["_tw`([^`]*)"]
}
@dashmedialtd
dashmedialtd / Button.tsx
Last active April 2, 2024 12:40
React Button Component
import { faChevronRight } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import Link from "next/link";
import { type ReactNode } from "react";
import { _tw, tw } from "~/styling/clsxAndTWMerge";
const designs = {
primary: _tw`z-20 text-white hover:text-neutral-950 uppercase text-sm font-medium tracking-widest leading-5 justify-between items-center bg-transparent hover:bg-green-300 py-2.5 px-5 rounded-lg border-4 border-green-300 transition-all`,
} satisfies Record<string, string>;
@dashmedialtd
dashmedialtd / clsxAndTWMerge.ts
Last active February 12, 2025 13:58
CLSX and TW Merge
import clsx, { type ClassValue } from "clsx";
import { extendTailwindMerge } from "tailwind-merge";
const customTailwindMerge = extendTailwindMerge({
extend: {
classGroups: {
"font-size": [
{
text: [(part: string) => /^\d{1,3}px$/.test(part)],
},
@dashmedialtd
dashmedialtd / Section.tsx
Last active March 5, 2024 11:00
React Section Component
import { type ReactNode } from "react";
import { tw } from "~/styling/clsxAndTWMerge";
type Props = {
children: ReactNode;
outerClassName?: string;
innerClassName?: string;
before?: ReactNode;
after?: ReactNode;
id?: string;
"use client";
import Lenis from "@studio-freight/lenis";
import { usePathname } from "next/navigation";
import { useEffect } from "react";
const SmoothScroll = () => {
const pathname = usePathname();
useEffect(() => {