Skip to content

Instantly share code, notes, and snippets.

View thevolcanomanishere's full-sized avatar
🍑

Alex McGonagle thevolcanomanishere

🍑
View GitHub Profile
@thevolcanomanishere
thevolcanomanishere / deploy-cloudflare-pages.yml
Last active July 15, 2024 12:56
Deploy to Cloudflare Pages example Github Action
name: Deploy React Static to Cloudflare Pages
on:
push:
branches: ["main"]
paths:
- "path/to/project/**"
pull_request:
branches: ["main"]
paths:
@thevolcanomanishere
thevolcanomanishere / ExampleComponent.tsx
Last active August 2, 2022 07:11
Toggling darkmode the easy way (Tailwind)
const ExampleComponent = () => {
return <h1 className="bg-white dark:bg-black">Hello</h1>;
};
export default ExampleComponent;
@thevolcanomanishere
thevolcanomanishere / DetectBreakpoint.tsx
Created July 28, 2022 11:20
Detecting Tailwind breakpoints in Typescript
const DetectBreakpoint = () => {
const getCurrentBreakpoint = (): string => {
const breakpointUnknown: string = "unknown";
const breakpointSM: string | null =
document.getElementById("breakpoint-sm")?.offsetParent === null
? null
: "sm";
const breakpointMD: string | null =
document.getElementById("breakpoint-md")?.offsetParent === null
? null