Skip to content

Commit

Permalink
Sort README paragraph order
Browse files Browse the repository at this point in the history
  • Loading branch information
magicismight committed Aug 17, 2021
1 parent 336031e commit 19dbd10
Showing 1 changed file with 38 additions and 38 deletions.
76 changes: 38 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,44 +124,6 @@ console.log(bem('button')('icon', 'active').toString()); // 'button--icon__activ
console.log(bem('button', 'icon')('active').toString()); // 'button--icon__active'
```

# React

```jsx
import React from 'react';
import { bem } from 'bem-composer';
import classNames from 'classnames';

const b = bem('button');
const e = b('icon');
const m = e('active');

export default function Button(props) {
const { active } = props;
return (
<button
classname={classNames([
b(), // 'button'
b('', {
name: 'active',
value: active
}) // button__active
])}
>
<img
classname={classNames([
e(), // 'button-icon'
e({
name: 'active',
value: active
}), // active === true ? 'button--icon__active' : 'button--icon'
e('primary') // 'button--icon__primary'
])}
/>
</button>
);
}
```

## BEM Constructor type definition

```ts
Expand Down Expand Up @@ -210,6 +172,44 @@ export interface BEMModifier {
}
```

# React

```jsx
import React from 'react';
import { bem } from 'bem-composer';
import classNames from 'classnames';

const b = bem('button');
const e = b('icon');
const m = e('active');

export default function Button(props) {
const { active } = props;
return (
<button
classname={classNames([
b(), // 'button'
b('', {
name: 'active',
value: active
}) // button__active
])}
>
<img
classname={classNames([
e(), // 'button-icon'
e({
name: 'active',
value: active
}), // active === true ? 'button--icon__active' : 'button--icon'
e('primary') // 'button--icon__primary'
])}
/>
</button>
);
}
```

# Styled-components & Linaria

```tsx
Expand Down

0 comments on commit 19dbd10

Please sign in to comment.