Skip to content

Instantly share code, notes, and snippets.

@kcoyner
Last active November 11, 2020 03:01
Show Gist options
  • Save kcoyner/b916755be060cc9c5863d70c163c9998 to your computer and use it in GitHub Desktop.
Save kcoyner/b916755be060cc9c5863d70c163c9998 to your computer and use it in GitHub Desktop.
styled-component
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