-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
87 additions
and
1 deletion.
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 characters
31 changes: 31 additions & 0 deletions
31
packages/benchmarks/src/implementations/styled-components-v6/Box.js
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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import styled from 'styled-components-v6'; | ||
import View from './View'; | ||
|
||
const getColor = color => { | ||
switch (color) { | ||
case 0: | ||
return '#14171A'; | ||
case 1: | ||
return '#AAB8C2'; | ||
case 2: | ||
return '#E6ECF0'; | ||
case 3: | ||
return '#FFAD1F'; | ||
case 4: | ||
return '#F45D22'; | ||
case 5: | ||
return '#E0245E'; | ||
default: | ||
return 'transparent'; | ||
} | ||
}; | ||
|
||
const Box = styled(View)` | ||
align-self: flex-start; | ||
flex-direction: ${props => (props.layout === 'column' ? 'column' : 'row')}; | ||
padding: ${props => (props.outer ? '4px' : '0')}; | ||
${props => props.fixed && 'height:6px;'} ${props => | ||
props.fixed && 'width:6px;'} background-color: ${props => getColor(props.color)}; | ||
`; | ||
|
||
export default Box; |
20 changes: 20 additions & 0 deletions
20
packages/benchmarks/src/implementations/styled-components-v6/Dot.js
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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import styled from 'styled-components-v6'; | ||
import View from './View'; | ||
|
||
const Dot = styled(View).attrs(p => ({ style: { borderBottomColor: p.color } }))` | ||
position: absolute; | ||
cursor: pointer; | ||
width: 0; | ||
height: 0; | ||
border-color: transparent; | ||
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`}; | ||
`; | ||
|
||
export default Dot; |
3 changes: 3 additions & 0 deletions
3
packages/benchmarks/src/implementations/styled-components-v6/Provider.js
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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import View from './View'; | ||
|
||
export default View; |
19 changes: 19 additions & 0 deletions
19
packages/benchmarks/src/implementations/styled-components-v6/View.js
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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import styled from 'styled-components-v6'; | ||
|
||
const View = styled.div` | ||
align-items: stretch; | ||
border-width: 0; | ||
border-style: solid; | ||
box-sizing: border-box; | ||
display: flex; | ||
flex-basis: auto; | ||
flex-direction: column; | ||
flex-shrink: 0; | ||
margin: 0; | ||
padding: 0; | ||
position: relative; | ||
min-height: 0; | ||
min-width: 0; | ||
`; | ||
|
||
export default View; |
11 changes: 11 additions & 0 deletions
11
packages/benchmarks/src/implementations/styled-components-v6/index.js
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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import Box from './Box'; | ||
import Dot from './Dot'; | ||
import Provider from './Provider'; | ||
import View from './View'; | ||
|
||
export default { | ||
Box, | ||
Dot, | ||
Provider, | ||
View | ||
}; |
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 characters