Last active
November 11, 2020 03:01
-
-
Save kcoyner/b916755be060cc9c5863d70c163c9998 to your computer and use it in GitHub Desktop.
styled-component
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import styled, { css } from 'styled-components'; | |
import React from 'react'; | |
interface Border extends React.HTMLAttributes<HTMLElement> { | |
isInEdit: boolean; | |
} | |
const border = css<Border>` | |
border: 1px solid ${({ isInEdit }) => (isInEdit ? 'red' : 'transparent')}; | |
&:hover { | |
border: 1px solid red; | |
} | |
`; | |
export const HighlightDiv = styled.div<Border>` | |
${border}; | |
`; | |
export const HighlightSection = styled.section<Border>` | |
${border} | |
`; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment