Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fancy - v2.0.0 #20

Merged
merged 5 commits into from
Jul 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .storybook/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"presets": [
"env",
"react",
"flow"
],
"plugins": [
"transform-class-properties",
"transform-flow-strip-types",
"transform-object-rest-spread"
]
}
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

> A simple way to include CSS with React Components.

- **Tiny**, around 4 KB gzipped
- **One dependency** - ([Stylis](https://github.com/thysultan/stylis.js))
- **[Emotion](https://github.com/emotion-js/emotion)**, under the hood.
- **Write** plain ol' CSS. Period.
- **Pre-processing** when you need it. Powered by [Stylis](https://github.com/thysultan/stylis.js).
- **Uniquely** generated classNames, [CSS Modules](https://github.com/css-modules/css-modules) style.
- **Integrate** with ease into your existing setup. No fiddling with Webpack required.
- **HTML primitive** creation, [Styled Components](https://www.styled-components.com/) style.
- **iFrame** support, out-of-the-box!
- **Theming** support!
- **Scoping**, to integrate into older (more hostile) CSS systems.

## πŸ”§ Installation

Expand All @@ -25,13 +24,6 @@ Here's a quick example of how you can compose regular CSS with your React compon
import React from 'react'
import styled from '@helpscout/fancy'

const css = `
.Button {
background: white;
border: 1px solid #eee;
}
`

const Button = props => {
const { children, styles, ...rest } = props

Expand All @@ -40,13 +32,21 @@ const Button = props => {
</button>
}

export default styled(Button)(css)
export default styled(Button)`
background: white;
border: 1px solid #eee;
`
```

## πŸ“˜ Documentation

[View the docs](./docs/) to get started with Fancy!

## Migration
## πŸ’Ό Migration

- [From v1.x to v2.x](./docs/migration/migration-1x-2x.md)
- [From v0.x to v1.x](./docs/migration/migration-0x-1x.md)

## ❀️ Credit

Many thanks to the folks who built [Emotion](https://github.com/emotion-js/emotion) and [Styled Components](https://github.com/styled-components/styled-components).
9 changes: 3 additions & 6 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
# Documentation

- [Getting started](./getting-started.md)
- [Nesting](./nesting.md)
- [Dynamic styles](./dynamic-styles.md)
- [Dynamic classNames](./dynamic-classnames.md)
- [Usage](./usage.md)
- [HTML primitives](./primitives.md)
- [iFrames](./iframes.md)
- [Theming](./theming.md)
- [Scoping](./scoping.md)
- [HTML primitives](./primitives.md)
- [Component styling](./component-styling.md)
- [Style interpolation](./style-interpolation.md)
29 changes: 0 additions & 29 deletions docs/component-styling.md

This file was deleted.

170 changes: 0 additions & 170 deletions docs/dynamic-classnames.md

This file was deleted.

32 changes: 0 additions & 32 deletions docs/dynamic-styles.md

This file was deleted.

30 changes: 12 additions & 18 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Getting started

Under the hood, Fancy is powered by an enhanced fork of [Emotion](https://emotion.sh/). It can do everything that Emotion can!

In this guide, we're going to be "fancifying" a React component with some basic CSS styles.

### Step 1: Import Fancy
Expand All @@ -14,11 +16,9 @@ import fancy from '@helpscout/fancy'
Write your CSS styles as a string. This is default out-of-the-box CSS. Use things like `:hover`, `@media` queries, as you normally would!

```jsx
const css = `
.Button {
background: white;
border: 1px solid #eee;
}
;`
background: white;
border: 1px solid #eee;
`
```

Expand Down Expand Up @@ -48,16 +48,12 @@ export default styled(Buton)(css)
import React from 'react'
import fancy from '@helpscout/fancy'

const css = `
.Button {
background: white;
border: 1px solid #eee;
}
`

const Button = props => <button className="Button" {...props} />

export default styled(Button)(css)
export default styled(Button)`
background: white;
border: 1px solid #eee;
`
```

### Results
Expand All @@ -66,15 +62,15 @@ export default styled(Button)(css)
<html>
<head>
<style type='text/css'>
.Button {
.css-123nd1 {
background: white;
border: 1px solid #eee;
}
</style>
</head>
<body>
...
<button class='Button'>Button</button>
<button class='css-123nd1'>Button</button>
...
</body>
</html>
Expand All @@ -84,7 +80,5 @@ That's it! You're done πŸ™Œ. You've created a CSS-ready component.

## See also

- [Primitives](./primitives.md)
- [Component styling](./component-styling.md)
- [Style interpolation](./style-interpolation.md)
- [Scoping](./scoping.md)
- [Theming](./theming.md)
Loading