Skip to content

Commit af10f5a

Browse files
agriffisgregberge
authored andcommitted
perf: add media query to benchmark
1 parent aa1f518 commit af10f5a

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

benchmarks/styled-components.js

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,37 @@ const styled = require('styled-components')
66

77
const suite = new Benchmark.Suite('styled')
88

9+
const md = '1024px'
910
const primary = 'primary'
1011
const sp3 = '3px'
1112
const sp1 = '1px'
1213

1314
function runXstyled() {
1415
const Component = xstyled.default.div`
15-
background: transparent;
16-
border-radius: 3px;
17-
border: 2px solid;
18-
border-color: primary;
19-
color: primary;
20-
margin: 0 3;
21-
padding: 1 3;
16+
@media (min-width: 1024px) {
17+
background: transparent;
18+
border-radius: 3px;
19+
border: 2px solid;
20+
border-color: primary;
21+
color: primary;
22+
margin: 0 3;
23+
padding: 1 3;
24+
}
2225
`
2326
React.createElement(Component, {})
2427
}
2528

2629
function runStyled() {
2730
const Component = styled.default.div`
28-
background: transparent;
29-
border-radius: 3px;
30-
border: 2px solid;
31-
border-color: ${() => primary};
32-
color: ${() => primary};
33-
margin: 0 ${() => sp3};
34-
padding: ${() => sp1} ${() => sp3};
31+
@media (min-width: ${() => md}) {
32+
background: transparent;
33+
border-radius: 3px;
34+
border: 2px solid;
35+
border-color: ${() => primary};
36+
color: ${() => primary};
37+
margin: 0 ${() => sp3};
38+
padding: ${() => sp1} ${() => sp3};
39+
}
3540
`
3641
React.createElement(Component, {})
3742
}

0 commit comments

Comments
 (0)