Skip to content

Instantly share code, notes, and snippets.

/// <reference types="react" />
declare module 'react-popover' {
type Falsey = false | null | undefined
type Place = 'above' | 'right' | 'below' | 'left' | 'row' | 'column' | 'start' | 'end'
export interface PopoverProps extends React.HTMLAttributes<any> {
body: React.ReactNode | React.ReactNode[]
enterExitTransitionDurationMs?: number
isOpen?: boolean
offset?: number
@masahirompp
masahirompp / ClientWidth.tsx
Created October 23, 2017 07:57
React Component, get clientWidth
import * as React from 'react'
import { debounce } from 'lodash'
interface Props {
childrenAsFunction: (width: number) => JSX.Element
}
interface State {
width: number
}
@masahirompp
masahirompp / react-dnd.d.ts
Created November 3, 2017 08:37
react-dnd.d.ts
// fork https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-dnd
// Type definitions for React DnD
// Project: https://github.com/gaearon/react-dnd
// TypeScript Version: 2.3
///<reference types="react" />
declare namespace __ReactDnd {
// Decorated React Components
declare module 'aws-api-gateway-client' {
import { AxiosResponse } from 'axios'
interface AwsApiGatewayClientConfig {
accessKey?: string
secretKey?: string
sessionToken?: string
region?: string
apiKey?: string
invokeUrl: string
@masahirompp
masahirompp / mui-datatables.d.ts
Last active September 4, 2018 02:45
mui-datatables types
declare module 'mui-datatables' {
interface CulumnOption {
display: boolean
filter: boolean
sort: boolean
customHeadRender: Function
customBodyRender: Function
}
interface ColumnProps {
import withStyles, { WithStyles } from '@material-ui/core/styles/withStyles'
import TableCell from '@material-ui/core/TableCell'
import TableRow from '@material-ui/core/TableRow'
import * as React from 'react'
interface Props {
term: string
}
type ClassKey = 'term' | 'description'
@masahirompp
masahirompp / jstTime.js
Last active September 24, 2021 07:40
Pure JavaScript JST Time
// どの環境で実行しても、JST時刻を取得する
const timeZoneOffset = 9 // JST
const getJstDate = () => {
const time = Date.now() // UTC millisecond
const date = new Date(time) // local date
const utcHours = date.getUTCHours() // UTC Hour
date.setHours(utcHours + timeZoneOffset) // UTC Hour + TimeZone Offset
return {
@masahirompp
masahirompp / generated.css
Last active October 12, 2020 12:12
tailwind css next-sibling margin
...
.-ml-px {
margin-left: -1px;
}
.child-siblings\:m-0 > * + * {
margin: 0;
}
.child-siblings\:m-1 > * + * {
margin: 0.25rem;
}