Skip to content

Instantly share code, notes, and snippets.

View rylanharper's full-sized avatar

Rylan Harper rylanharper

View GitHub Profile
@rylanharper
rylanharper / color-selector.tsx
Created August 22, 2025 00:35
A color-selector Sanity UI component
import { Flex, Stack, Text } from '@sanity/ui'
import React, { useCallback } from 'react'
import { set, StringInputProps, unset } from 'sanity'
type ColorCircleProps = {
colorName: string
hex: string
active: boolean
onClickHandler: (val: string) => void
}
@rylanharper
rylanharper / router.options.ts
Created November 25, 2024 02:28
Nuxt3 `router.options.ts` update; scroll jump fix
import type { RouteLocationNormalized } from '#vue-router';
import type { RouterConfig } from 'nuxt/schema';
import { START_LOCATION } from 'vue-router';
import { useNuxtApp } from '#app/nuxt';
function calculatePosition(
to: RouteLocationNormalized,
savedPosition: ScrollToOptions | null,
@rylanharper
rylanharper / [slug].vue
Created March 11, 2024 20:36
Nuxt3 + Sanity Previews Setup (Pre Visual-Editing)
<script setup>
const query = groq`*[_type == "page" && slug.current == $slug]|order(_updatedAt desc)[0] {
... // your schema data
}`
// Create slug
const route = useRoute()
const params = {
slug: route.params.slug
}
@rylanharper
rylanharper / gsap.js
Last active February 18, 2024 04:42
Basic gsap menu with clipPath in Nuxt3
import { gsap } from 'gsap'
import { CustomEase } from 'gsap/CustomEase'
import { ScrollTrigger } from 'gsap/ScrollTrigger'
import { ScrollToPlugin } from 'gsap/ScrollToPlugin'
export default defineNuxtPlugin(async () => {
gsap.registerPlugin(CustomEase, ScrollToPlugin, ScrollTrigger)
return {
provide: { gsap, CustomEase, ScrollToPlugin, ScrollTrigger }
@rylanharper
rylanharper / app.vue
Last active November 4, 2023 21:30
Nuxt3 GSAP NuxtPage Transition
<nuxt-page :transition="globalTransition" />
@rylanharper
rylanharper / Groq
Last active March 19, 2026 21:45
Sanity + Nuxt3 + Nuxt Image(RC) → Using Blurhash & Lazysizes
_type == "picture" => {
_type,
"image": {
...,
"height": asset->metadata.dimensions.height,
"width": asset->metadata.dimensions.width,
"dimensions": asset->metadata.dimensions,
"blurhash": asset->metadata.blurHash,
"lqip": asset->metadata.lqip
}
@rylanharper
rylanharper / product-reference.txt
Last active March 24, 2023 02:02
Shopify Metafield Product Reference List With Vue(2) or Vue(3) | 2023-01 API Version
export default {
name: 'ProductReference',
props: {
product: {
type: Object,
required: true
}
},