Skip to content

Instantly share code, notes, and snippets.

View antoinelin's full-sized avatar

Antoine Lin antoinelin

View GitHub Profile
@antoinelin
antoinelin / Icon.tsx
Created July 15, 2024 08:54
Create and use SVG sprite in React apps
import { IconName } from "./Icon.types";
import { sprite } from "./sprite";
export type IconProps = {
name: IconName;
title?: string;
label?: string;
className?: string;
style?: React.CSSProperties;
};
@antoinelin
antoinelin / creator_micro.layout.json
Last active January 26, 2024 21:50
My Worklouder Creator Micro profile. Layer 0 is dedicated to Figma
{
"name": "Creator Micro",
"vendorProductId": 1464657635,
"macros": [
"",
"",
"",
"",
"",
"",
@antoinelin
antoinelin / client-query.tsx
Last active January 22, 2025 05:58
GraphQL Urql client with multiple GraphQL endpoints
function getDataFromEndpointA() {
const { data } = await client.query(myQueryForEndpointA, {}, {
clientName: 'endpoint-a',
}).toPromise()
return data
}
function getDataFromEndpointB() {
const { data } = await client.query(myQueryForEndpointB, {}, {
@antoinelin
antoinelin / client.ts
Last active June 16, 2020 09:00
Use Urql with Prismic CMS
import {
createClient,
Exchange,
Operation,
dedupExchange,
fetchExchange,
} from 'urql'
import { cacheExchange } from '@urql/exchange-graphcache'
import Prismic from 'prismic-javascript'
import { pipe, mergeMap, fromPromise, map } from 'wonka'