Skip to content

Instantly share code, notes, and snippets.

@opensourcekam
Created April 21, 2019 20:37
Show Gist options
  • Save opensourcekam/1e9819a0fc83ababdbcd03a99ebf32e1 to your computer and use it in GitHub Desktop.
Save opensourcekam/1e9819a0fc83ababdbcd03a99ebf32e1 to your computer and use it in GitHub Desktop.

Revisions

  1. opensourcekam created this gist Apr 21, 2019.
    11 changes: 11 additions & 0 deletions styled-component.ts
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    import styled, { StyledFunction } from "styled-components"

    interface YourProps {
    invalid: boolean
    }

    const input: StyledFunction<YourProps & React.HTMLProps<HTMLInputElement>> = styled.input

    const Input = input`
    border: ${p => p.invalid ? 'red' : 'blue'};
    `