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

@@ -16,7 +16,7 @@ import {
colors,
} from 'sonar';
const Heading = Text.extends({
const Heading = styled(Text)({
display: 'block',
backgroundColor: colors.white,
color: colors.light30,
@@ -26,7 +26,7 @@ const Heading = Text.extends({
padding: '4px 8px 0',
});
const PopoverItem = FlexRow.extends({
const PopoverItem = styled(FlexRow)({
alignItems: 'center',
borderBottom: `1px solid ${colors.light05}`,
height: 50,
@@ -35,7 +35,7 @@ const PopoverItem = FlexRow.extends({
},
});
const ItemTitle = Text.extends({
const ItemTitle = styled(Text)({
display: 'block',
fontSize: 14,
fontWeight: 400,
@@ -46,7 +46,7 @@ const ItemTitle = Text.extends({
marginBottom: 1,
});
const ItemSubtitle = Text.extends({
const ItemSubtitle = styled(Text)({
display: 'block',
fontWeight: 400,
fontSize: 11,
@@ -57,20 +57,20 @@ const ItemSubtitle = Text.extends({
whiteSpace: 'nowrap',
});
const ItemImage = FlexBox.extends({
const ItemImage = styled(FlexBox)({
alignItems: 'center',
justifyContent: 'center',
width: 40,
flexShrink: 0,
});
const ItemContent = styled.view({
const ItemContent = styled('div')({
minWidth: 0,
paddingRight: 5,
flexGrow: 1,
});
const Section = styled.view({
const Section = styled('div')({
maxWidth: 260,
borderBottom: `1px solid ${colors.light05}`,
'&:last-child': {
@@ -78,7 +78,7 @@ const Section = styled.view({
},
});
const Action = Button.extends({
const Action = styled(Button)({
border: `1px solid ${colors.macOSTitleBarButtonBorder}`,
background: 'transparent',
color: colors.macOSTitleBarIconSelected,