Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save russellr922/754ff0510b022a943214e1b25c36c4da to your computer and use it in GitHub Desktop.
Save russellr922/754ff0510b022a943214e1b25c36c4da to your computer and use it in GitHub Desktop.
Styled Components Mixin example
// Mixin like functionality
const textInput = props => `
color: ${props.error ? color.white : color.base};
background-color: ${props.error ? color.alert : color.white};
`;
export const Input = styled.input`
${textInput}
`;
export const Textarea = styled.textarea`
${textInput};
height: ${props => props.height ? props.height : '130px'}
resize: none;
overflow: auto;
`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment