Skip to content

Commit a66bb0e

Browse files
emmatownKye Hohenberger
authored and
Kye Hohenberger
committed
Move theming into its own file (#130)
1 parent c0e000a commit a66bb0e

File tree

9 files changed

+16
-11
lines changed

9 files changed

+16
-11
lines changed

docs/theming.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## Theming
22

33
```jsx
4-
import { ThemeProvider, withTheme } from 'emotion/react'
4+
import { ThemeProvider, withTheme } from 'emotion/react/theming'
55
```
66

77
Theming is provided by the theming library.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"src",
99
"dist",
1010
"lib",
11-
"react.js",
11+
"react",
1212
"server.js",
1313
"vue.js",
1414
"dist/DO-NOT-USE.min.js"

react.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

react/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('../lib/react')

react/theming.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('../lib/react/theming')

src/react/constants.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const CHANNEL = '__emotion__'

src/react.js renamed to src/react/index.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
import { Component, createElement as h } from 'react'
2-
import { createTheming } from 'theming'
32
import PropTypes from 'prop-types'
43
import map from '@arr/map'
5-
import { css } from './index'
6-
import { omit } from './utils'
7-
8-
const theming = createTheming('__emotion__')
9-
const { channel: CHANNEL, withTheme, ThemeProvider } = theming
10-
export { CHANNEL, withTheme, ThemeProvider }
4+
import { css } from '../index'
5+
import { omit } from '../utils'
6+
import { CHANNEL } from './constants'
117

128
export default function (tag, cls, vars = [], content) {
139
if (!tag) {

src/react/theming.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { createTheming } from 'theming'
2+
import { CHANNEL } from './constants'
3+
4+
const theming = createTheming(CHANNEL)
5+
const { withTheme, ThemeProvider } = theming
6+
export { CHANNEL, withTheme, ThemeProvider }

test/react.test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import React from 'react'
33
import renderer from 'react-test-renderer'
44
import { matcher, serializer } from '../jest-utils'
55
import { css } from '../src/index'
6-
import styled, { ThemeProvider } from '../src/react'
6+
import styled from '../src/react'
7+
import { ThemeProvider } from '../src/react/theming'
78

89
import { lighten, hiDPI, modularScale, borderWidth } from 'polished'
910

0 commit comments

Comments
 (0)