Created
December 5, 2019 06:54
Revisions
-
timsully created this gist
Dec 5, 2019 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ // You can pass a function to your style declarations with one parameter which is component's // props. You can then use props to adjust your styling. import React from 'react' import ReactDOM from 'react-dom' import styled from 'styled-components' const StyledButton = styled.button` border-radius: 5px; background-color: ${props => (props.secondary ? '#F7A072' : '#a1cdf1')}; color: #fff; padding: 10px 15px; outline: none; border: none; cursor: pointer; margin: 15px; ` const Application = () => { return ( <div> <StyledButton>Click me</StyledButton> <StyledButton secondary>Click for secondary Action</StyledButton> </div> ) } 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ // Basic Usage of Styled-Components import React from 'react' import styled from 'styled-components' const StyledButton = styled.button` border-radius: 5px; background-color: #a1cdf1; color #fff; padding: 10px 15px; outline: none; border: none; cursor: pointer; ` const Application = () => { return <StyledButton onClick={() => console.log('clicked')}>Click me</StyledButton> }