convert to emotion

Summary:
My benchmarks have shown react-emotion to be faster than the current implementation of `styled`. For this reason, I am converting all styling to [emotion](https://emotion.sh).

Benchmark results:
{F136839093}

The syntax is very similar between the two libraries. The main difference is that emotion only allows a single function for the whole style attribute, whereas the old implementation had functions for every style-attirbute.

Before:
```
{
  color: props => props.color,
  fontSize: props => props.size,
}
```

After:
```
props => ({
  color: props.color,
  fontSize: props.size,
})
```

Reviewed By: jknoxville

Differential Revision: D9479893

fbshipit-source-id: 2c39e4618f7e52ceacb67bbec8ae26114025723f
This commit is contained in:
Daniel Büchele
2018-08-23 09:32:12 -07:00
committed by Facebook Github Bot
parent 4151c73409
commit 726966fdc0
88 changed files with 886 additions and 4068 deletions

View File

@@ -18,34 +18,29 @@ import {clipboard} from 'electron';
const deepEqual = require('deep-equal');
const BaseContainer = styled.view(
{
fontFamily: 'Menlo, monospace',
fontSize: 11,
lineHeight: '17px',
filter: props => (props.disabled ? 'grayscale(100%)' : ''),
margin: props => (props.depth === 0 ? '7.5px 0' : '0'),
paddingLeft: 10,
userSelect: 'text',
},
{
ignoreAttributes: ['depth', 'disabled'],
},
);
const BaseContainer = styled('div')(props => ({
fontFamily: 'Menlo, monospace',
fontSize: 11,
lineHeight: '17px',
filter: props.disabled ? 'grayscale(100%)' : '',
margin: props.depth === 0 ? '7.5px 0' : '0',
paddingLeft: 10,
userSelect: 'text',
}));
const RecursiveBaseWrapper = styled.text({
const RecursiveBaseWrapper = styled('span')({
color: colors.red,
});
const Wrapper = styled.text({
const Wrapper = styled('span')({
color: '#555',
});
const PropertyContainer = styled.text({
const PropertyContainer = styled('span')({
paddingTop: '2px',
});
const ExpandControl = styled.text({
const ExpandControl = styled('span')({
color: '#6e6e6e',
fontSize: 10,
marginLeft: -11,
@@ -53,7 +48,7 @@ const ExpandControl = styled.text({
whiteSpace: 'pre',
});
export const InspectorName = styled.text({
export const InspectorName = styled('span')({
color: colors.grapeDark1,
});
@@ -474,10 +469,10 @@ export default class DataInspector extends Component<DataInspectorProps> {
const keys = getSortedKeys({...value, ...diffValue});
const Added = styled.view({
const Added = styled('div')({
backgroundColor: colors.tealTint70,
});
const Removed = styled.view({
const Removed = styled('div')({
backgroundColor: colors.cherryTint70,
});