Skip to content

Instantly share code, notes, and snippets.

View davo's full-sized avatar
🦮
Golden

Davo Galavotti davo

🦮
Golden
View GitHub Profile
@davo
davo / Colors.tsx
Created May 21, 2019 21:38
Reusing Framer X Shared Colors on a Function Component
import * as React from 'react'
import { Stack, Frame } from 'framer'
import { colors } from './canvas'
export function Colors() {
const [colorsTokens] = React.useState(() => {
return Object.keys(colors).map(key => colors[key])
})
return (
@davo
davo / observable.tsx
Created May 20, 2019 21:44
Observable book on Framer X
import * as React from 'react'
import { useState, useEffect, useRef } from 'react'
import { Frame, addPropertyControls, ControlType } from 'framer'
import { Runtime, Inspector } from '@observablehq/runtime'
import notebook from '@davo/bar-chart-race'
export function Observable({ tick }) {
const [tickDuration, setTickDuration] = useState(tick)
const animationRef = useRef()
@davo
davo / WindowResizeListener.tsx
Created May 17, 2019 22:32
Framer X WindowResizeListener
// https://framer.slack.com/archives/CB74N2FDY/p1557954143213500?thread_ts=1557952502.211200&cid=CB74N2FDY
import { Override, Data } from "framer"
import * as React from "react"
const initialSize = document.body.getBoundingClientRect()
const preview = Data({ width: initialSize.width, height: initialSize.height })
@davo
davo / regexs.md
Created May 14, 2019 15:18
Handy Regular Expressions

Capturing a class from a HTML / SVG element.

(class="([^"]*)")
@davo
davo / ComponentHoverStyledComponents.tsx
Created May 6, 2019 15:33
Component with Hover via StyledComponents
import * as React from 'react'
import { useState, useEffect } from 'react'
import { Frame, addPropertyControls, ControlType } from 'framer'
import styled, { css } from 'styled-components'
interface Props {
padding?: number
paddingLeft?: number
color?: string
listBackgroundColor?: string
@davo
davo / Table.tsx
Created April 23, 2019 22:12
Custom CSS Props with Styled Components
import * as React from 'react'
import ReactTable from 'react-table'
import { CSSCustomProperties, TableWrapper } from './TableWrapper'
interface Props {
rowSize?: string | number
}
export class Table extends React.Component<Props> {
static defaultProps = {
@davo
davo / command.sh
Created April 4, 2019 17:21
How to Exclude Sketch From Dark Mode in macOS Mojave
osascript -e 'id of app "Sketch"'
defaults write com.bohemiancoding.sketch3 NSRequiresAquaSystemAppearance -bool yes
@davo
davo / LinkContainer.tsx
Created April 4, 2019 16:09
LinkContainer from React Router Bootstrap
@davo
davo / MatchUse.md
Last active April 5, 2019 17:30
Regex to match use{Def} on JS libraries
@davo
davo / data.js
Last active March 13, 2019 19:34
Transforming Data
{
"cardData": {
"indica": [{
"brandName": "Paris OG",
"title": "Louis XIII OG",
"subtitle": "4.9",
"image": "https://images.weedmaps.com/products/000/019/694/avatar/original/1525137648-Louis_XIII_OG.jpg"
},
{
"brandName": "Kush Rush Exotics",