Skip to content

Instantly share code, notes, and snippets.

View ardblok's full-sized avatar

Ard Blok ardblok

View GitHub Profile
@ardblok
ardblok / Stack.tsx
Last active January 18, 2025 16:44
A flexible React component for creating layouts using flexbox. Built with TypeScript and styled-components.
import { JSX } from 'react'
import styled, { css } from 'styled-components'
/**
* Stack component for flexible layouts using flexbox
*
* @example
* Basic usage:
* <Stack gap={16}>
* <div>Item 1</div>
// Simple function that checks if a set of coordinates are intersecting with another set of coordinates
// Useful for checking if a selection net intersects with nodes on a canvas
function isIntersecting(a: Coordinates, b: Coordinates) {
if (a.x1 > b.x0 && a.x0 < b.x1 && a.y1 > b.y0 && a.y0 < b.y1) {
return true
}
return false
}
interface Coordinates {
//
// ShortcutsGallery.swift
//
import SwiftUI
struct ShortcutsGallery: View {
var body: some View {
NavigationView {