Skip to content

Instantly share code, notes, and snippets.

View davo's full-sized avatar
🏠

Davo Galavotti davo

🏠
View GitHub Profile
@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",
@davo
davo / isCanvasOrPreview.tsx
Created March 4, 2019 21:30
Framer X Check if component is on Canvas or Preview Window (via @steveruizok)
const isCanvasOrPreview = (source: any) => {
const searchLoop: (node: any) => 'canvas' | 'preview' = node => {
if (!node) return 'canvas'
if (node.key === 'preview') return 'preview'
return searchLoop(node._debugOwner)
}
return searchLoop(source._reactInternalFiber)
}
@davo
davo / GenericComponent.tsx
Last active March 1, 2019 17:45
Framer X RFC
import * as React from 'react'
import { PropertyControls, ControlType } from 'framer'
interface WithPropertyControls<P> extends React.SFC<P> {
propertyControls?: PropertyControls
}
declare type RFC<P> = WithPropertyControls<P>
interface Props {
@davo
davo / iphone-frame-overlay-app.js
Created January 21, 2019 04:40 — forked from vincentriemer/iphone-frame-overlay-app.js
Video iPhone Frame Overlay Web App Prototype
import React, { Component, useCallback, useState, useRef } from "react";
import "./App.css";
const imgUrl = require("./assets/iPhone-XS-Portrait-Space-Gray.png");
const fullSize = {
width: 1325,
height: 2616
};
@davo
davo / scrap.js
Created January 15, 2019 12:34
Scrapping from the DevTools
copy(
Array.from(document.querySelectorAll('p')).map(p => {
const t = p.innerText
return {
t
}
})
)