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

@@ -20,13 +20,13 @@ type SandboxState = {|
showFeedback: boolean,
|};
const BigButton = Button.extends({
const BigButton = styled(Button)({
flexGrow: 1,
fontSize: 24,
padding: 20,
});
const ButtonContainer = FlexColumn.extends({
const ButtonContainer = styled(FlexColumn)({
alignItems: 'center',
padding: 20,
});
@@ -42,7 +42,7 @@ export default class SandboxView extends SonarPlugin<SandboxState> {
static id = 'Sandbox';
static icon = 'translate';
static TextInput = styled.textInput({
static TextInput = styled('input')({
border: `1px solid ${colors.light10}`,
fontSize: '1em',
padding: '0 5px',
@@ -52,13 +52,13 @@ export default class SandboxView extends SonarPlugin<SandboxState> {
flexGrow: 1,
});
static FeedbackMessage = styled.text({
static FeedbackMessage = styled('span')({
fontSize: '1.2em',
paddingTop: '10px',
color: 'green',
});
static TextInputLayout = FlexColumn.extends({
static TextInputLayout = styled(FlexColumn)({
float: 'left',
justifyContent: 'center',
flexGrow: 1,