-
-
Notifications
You must be signed in to change notification settings - Fork 39
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
1 parent
3ca5a54
commit fff1f85
Showing
8 changed files
with
335 additions
and
11 deletions.
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
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
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
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
95 changes: 95 additions & 0 deletions
95
packages/pigment-css-react/tests/sx/fixtures/sx-array.input.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,95 @@ | ||
import { jsx as _jsx } from 'react/jsx-runtime'; | ||
|
||
<div sx={[{ opacity: 1 }]} />; | ||
|
||
<div className="foo" style={{ opacity: 1 }} sx={[{ color: 'red' }, { color: 'green' }]} />; | ||
|
||
function App(props) { | ||
return ( | ||
<SliderRail | ||
{...props} | ||
sx={[ | ||
props.variant === 'secondary' | ||
? { color: props.isRed ? 'red' : 'blue' } | ||
: { backgroundColor: 'blue', color: 'white' }, | ||
(theme) => ({ | ||
border: `1px solid ${theme.palette.primary.main}`, | ||
}), | ||
]} | ||
/> | ||
); | ||
} | ||
|
||
function App2(props) { | ||
return ( | ||
<SliderRail | ||
sx={[ | ||
{ color: 'green' }, | ||
props.variant === 'secondary' && { color: props.isRed ? 'red' : 'blue' }, | ||
]} | ||
className={`foo ${props.className}`} | ||
style={{ | ||
color: 'red', | ||
...props.style, | ||
}} | ||
/> | ||
); | ||
} | ||
|
||
_jsx('div', { | ||
sx: [ | ||
{ | ||
opacity: 1, | ||
}, | ||
], | ||
}); | ||
|
||
_jsx('div', { | ||
className: 'foo', | ||
style: { | ||
opacity: 1, | ||
}, | ||
sx: [ | ||
{ | ||
color: 'red', | ||
}, | ||
{ | ||
color: 'green', | ||
}, | ||
], | ||
}); | ||
|
||
function App3(props) { | ||
return _jsx('div', { | ||
sx: [ | ||
(theme) => ({ | ||
border: `1px solid ${theme.palette.primary.main}`, | ||
}), | ||
props.disabled | ||
? { | ||
opacity: 0.4, | ||
} | ||
: { | ||
color: 'red', | ||
}, | ||
], | ||
children: 'test', | ||
...props, | ||
}); | ||
} | ||
|
||
function App4(props) { | ||
return _jsx('div', { | ||
sx: [ | ||
(theme) => ({ | ||
border: `1px solid ${theme.palette.primary.main}`, | ||
}), | ||
props.variant === 'secondary' && { color: props.isRed ? 'red' : 'blue' }, | ||
], | ||
className: `foo ${props.className}`, | ||
style: { | ||
color: 'red', | ||
...props.style, | ||
}, | ||
}); | ||
} |
49 changes: 49 additions & 0 deletions
49
packages/pigment-css-react/tests/sx/fixtures/sx-array.output.css
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,49 @@ | ||
.dnf03uj { | ||
opacity: 1; | ||
} | ||
.dsvwfmp { | ||
color: red; | ||
} | ||
.d121rcfp { | ||
color: green; | ||
} | ||
.schfkcb { | ||
color: var(--schfkcb-0); | ||
} | ||
.s1cp79ho { | ||
background-color: blue; | ||
color: white; | ||
} | ||
.soyt4ij { | ||
border: 1px solid red; | ||
} | ||
.sr48wd1 { | ||
color: green; | ||
} | ||
.s6s70bv { | ||
color: var(--s6s70bv-0); | ||
} | ||
.s1v8upwb { | ||
opacity: 1; | ||
} | ||
.sjtfjpx { | ||
color: red; | ||
} | ||
.s1r80n7h { | ||
color: green; | ||
} | ||
.s1gu7ed8 { | ||
border: 1px solid red; | ||
} | ||
.s1h4vmh2 { | ||
opacity: 0.4; | ||
} | ||
.s1oy2sl1 { | ||
color: red; | ||
} | ||
.s14d8kn5 { | ||
border: 1px solid red; | ||
} | ||
.s1su4mia { | ||
color: var(--s1su4mia-0); | ||
} |
127 changes: 127 additions & 0 deletions
127
packages/pigment-css-react/tests/sx/fixtures/sx-array.output.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,127 @@ | ||
import { | ||
sx as _sx, | ||
sx as _sx2, | ||
sx as _sx3, | ||
sx as _sx4, | ||
sx as _sx5, | ||
sx as _sx6, | ||
sx as _sx7, | ||
sx as _sx8, | ||
} from '@pigment-css/react'; | ||
import { jsx as _jsx } from 'react/jsx-runtime'; | ||
<div {..._sx(['dnf03uj'], {})} />; | ||
<div | ||
className="foo" | ||
style={{ | ||
opacity: 1, | ||
}} | ||
{..._sx2(['dsvwfmp', 'd121rcfp'], { | ||
className: 'foo', | ||
style: { | ||
opacity: 1, | ||
}, | ||
})} | ||
/>; | ||
function App(props) { | ||
return ( | ||
<SliderRail | ||
{...props} | ||
{..._sx3( | ||
[ | ||
props.variant === 'secondary' | ||
? { | ||
className: 'schfkcb', | ||
vars: { | ||
'schfkcb-0': [props.isRed ? 'red' : 'blue', false], | ||
}, | ||
} | ||
: 's1cp79ho', | ||
'soyt4ij', | ||
], | ||
{ | ||
...props, | ||
}, | ||
)} | ||
/> | ||
); | ||
} | ||
function App2(props) { | ||
return ( | ||
<SliderRail | ||
className={`foo ${props.className}`} | ||
style={{ | ||
color: 'red', | ||
...props.style, | ||
}} | ||
{..._sx4( | ||
[ | ||
'sr48wd1', | ||
props.variant === 'secondary' && { | ||
className: 's6s70bv', | ||
vars: { | ||
's6s70bv-0': [props.isRed ? 'red' : 'blue', false], | ||
}, | ||
}, | ||
], | ||
{ | ||
className: `foo ${props.className}`, | ||
style: { | ||
color: 'red', | ||
...props.style, | ||
}, | ||
}, | ||
)} | ||
/> | ||
); | ||
} | ||
_jsx('div', { | ||
..._sx5(['s1v8upwb'], {}), | ||
}); | ||
_jsx('div', { | ||
className: 'foo', | ||
style: { | ||
opacity: 1, | ||
}, | ||
..._sx6(['sjtfjpx', 's1r80n7h'], { | ||
className: 'foo', | ||
style: { | ||
opacity: 1, | ||
}, | ||
}), | ||
}); | ||
function App3(props) { | ||
return _jsx('div', { | ||
children: 'test', | ||
...props, | ||
..._sx7(['s1gu7ed8', props.disabled ? 's1h4vmh2' : 's1oy2sl1'], { | ||
...props, | ||
}), | ||
}); | ||
} | ||
function App4(props) { | ||
return _jsx('div', { | ||
className: `foo ${props.className}`, | ||
style: { | ||
color: 'red', | ||
...props.style, | ||
}, | ||
..._sx8( | ||
[ | ||
's14d8kn5', | ||
props.variant === 'secondary' && { | ||
className: 's1su4mia', | ||
vars: { | ||
's1su4mia-0': [props.isRed ? 'red' : 'blue', false], | ||
}, | ||
}, | ||
], | ||
{ | ||
className: `foo ${props.className}`, | ||
style: { | ||
color: 'red', | ||
...props.style, | ||
}, | ||
}, | ||
), | ||
}); | ||
} |
Oops, something went wrong.