Last active
October 9, 2018 09:16
-
-
Save lomse/747c83a2c59c8ee29aa830afe11d111a to your computer and use it in GitHub Desktop.
Styled Components
This file contains hidden or 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 React from "react" | |
import PropTypes from "prop-types" | |
import styled from 'styled-components' | |
const StyledList = styled.li` | |
list-style: none; | |
overflow: hidden; | |
width: 100%; | |
margin-bottom: 10px | |
` | |
const StyledLabel = styled.label` | |
float: left; | |
cursor: pointer | |
` | |
const StyledButton = styled.button` | |
float: right; | |
background: palevioletred; | |
color: #FFF; | |
border-radius: 3px; | |
border: 2px solid palevioletred; | |
padding: 3px 10px; | |
outline: none; | |
cursor: pointer | |
` | |
const TodoItem = props => { | |
const { id, title } = props | |
return ( | |
<StyledList> | |
<StyledLabel htmlFor={id}> | |
<input type="checkbox" id={id} /> {title} | |
</StyledLabel> | |
<StyledButton type="button">Delete</StyledButton> | |
</StyledList> | |
) | |
} | |
TodoItem.propTypes = { | |
title: PropTypes.string.isRequired, | |
id: PropTypes.string.isRequired | |
} | |
export default TodoItem |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment