diff --git a/.babelrc b/.babelrc index cf6385eeb6..88d2269fff 100644 --- a/.babelrc +++ b/.babelrc @@ -1,7 +1,6 @@ { "presets": ["react", "env"], "plugins": [ - "styled-jsx/babel", "transform-class-properties", "transform-object-rest-spread", "babel-plugin-styled-components" diff --git a/docs/theming.md b/docs/theming.md deleted file mode 100644 index 288d6911ce..0000000000 --- a/docs/theming.md +++ /dev/null @@ -1,28 +0,0 @@ -# Theming - -Theming is based on [cssinjs/theming](https://github.com/cssinjs/theming) and [orbit-design-tokens](https://github.com/kiwicom/orbit-design-tokens) packages. - -## Main benefits of cssinjs/theming -- Allow simple merging of themes -- Can be used with multiple css in js solutions (styled-jsx, styled-components) - -## Theming sample - -### Sample Themed Component -- contains simple [ComponentWithTheme](/src/Theming/ThemedSample.js), which uses 3 design tokens: colorTextPrimary, fontFamily and lineHeightText. -- ComponentWithTheme use provided tokens to style itself and also display token values. -- ComponentWithTheme is exported in two versions - - as RawComponent which only uses tokens provided by theme prop - - ThemedComponent which expect usage inside ThemeProvider which provide theme prop - -### Theme Provider -- is basically [cssinjs/theming ThemeProvider](https://github.com/cssinjs/theming#themeprovider), except it uses orbit-design-tokens as default theme - -### Sample usage -- [Theming.stories.js](src/Theming/Theming.stories.js) -- please look at storybook for details - -## Alternative theming solutions - - https://medium.com/@mweststrate/how-to-safely-use-react-context-b7e343eff076 - - https://github.com/ReactTraining/react-broadcast - diff --git a/package.json b/package.json index 5adbdcf431..5b40b7c729 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "storybook": "start-storybook -p 6007 -c .storybook", "build": "yarn clean && yarn build:icons && yarn build:lib && yarn build:module", "build:lib": "babel --out-dir lib --ignore *.stories.js,*.test.js,*.storyshot src --copy-files", - "build:module": "babel --presets react --plugins styled-jsx/babel,babel-plugin-styled-components,transform-class-properties,transform-object-rest-spread --no-babelrc --out-dir es --ignore *.stories.js,*.test.js,*.storyshot src --copy-files", + "build:module": "babel --presets react --plugins babel-plugin-styled-components,transform-class-properties,transform-object-rest-spread --no-babelrc --out-dir es --ignore *.stories.js,*.test.js,*.storyshot src --copy-files", "build:icons": "node config/build.js", "clean": "rimraf lib es src/icons/*.js", "prepare": "npm run build", @@ -39,8 +39,7 @@ "peerDependencies": { "react": "^16.3.2", "react-dom": "^16.3.2", - "styled-components": "^3.2.6", - "styled-jsx": "^2.2.6" + "styled-components": "^3.2.6" }, "dependencies": { "@kiwicom/orbit-design-tokens": "^0.1.1", @@ -97,7 +96,6 @@ "react-test-renderer": "^16.3.2", "rimraf": "^2.6.2", "styled-components": "^3.2.6", - "styled-jsx": "^2.2.6", "svg2png": "^4.1.1", "svgo": "^1.0.5" }, diff --git a/readme.md b/readme.md index ee5c8e8380..330643a1f7 100644 --- a/readme.md +++ b/readme.md @@ -40,3 +40,45 @@ Please checkout our [Contribution Guide](./.github/contributing.md). It includes Orbit Components provides a set of icons easily used following these [instructions](./src/icons/readme.md). A list of all supported icons is [here](./src/icons/icons.md) + + +## Theming + +Orbit uses `styled-components` Theme provider + +```javascript + import { ThemeProvider } from "styled-components"; + import { defaultTokens } from "@kiwicom/orbit-design-tokens"; + + ... + + return ( + +