Skip to content

Commit

Permalink
Merge pull request #1852 from styled-components/fix-benchmarks
Browse files Browse the repository at this point in the history
Switch from .attrs to interpolations in benchmarks
  • Loading branch information
mxstbr committed Jul 18, 2018
2 parents 5bddab8 + cefdedd commit 2b121c0
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions benchmarks/src/implementations/styled-components/Dot.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,7 @@
import styled from 'styled-components';
import View from './View';

const Dot = styled(View).attrs({
style: props => ({
marginLeft: `${props.x}px`,
marginTop: `${props.y}px`,
borderRightWidth: `${props.size / 2}px`,
borderBottomWidth: `${props.size / 2}px`,
borderLeftWidth: `${props.size / 2}px`,
borderBottomColor: `${props.color}`
})
})`
const Dot = styled(View)`
position: absolute;
cursor: pointer;
width: 0;
Expand All @@ -20,6 +11,12 @@ const Dot = styled(View).attrs({
border-style: solid;
border-top-width: 0;
transform: translate(50%, 50%);
margin-left: ${props => props.x + 'px'};
margin-top: ${props => props.y + 'px'};
border-right-width: ${props => props.size / 2 + 'px'};
border-bottom-width: ${props => props.size / 2 + 'px'};
border-left-width: ${props => props.size / 2 + 'px'};
border-bottom-color: ${props => props.color};
`;

export default Dot;

0 comments on commit 2b121c0

Please sign in to comment.