This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as React from 'react'; | |
| import { cn, ClassNameFormatter } from '@bem-react/classname'; | |
| import { withBemClassName } from '@bem-react/core'; | |
| const block = cn('Block'); | |
| interface IBlockProps { | |
| wow?: string; | |
| className?: ClassNameFormatter; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| import styled from "styled-components"; | |
| import { bemClassName } from 'bem-react-core'; | |
| import { react } from '@bem/sdk.naming.presets'; | |
| import logo from './logo.svg'; | |
| import './App.css'; | |
| const bemed = (block, mods) => (elemPure) => { | |
| const naming = bemClassName(react); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Button from '../Button'; | |
| import Icon from '../Icon'; | |
| class CSelect { | |
| public dependencies() { | |
| return { | |
| Icon, | |
| Button | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export function compose<T0, T1 extends T0, T2 extends T0>(a: T0, b:T1, c: T2): T1 & T2; | |
| export function compose<T0, T1>(a: T0, b:T1): T0 & T1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Bem { | |
| } | |
| // src/common/Block/Block.js | |
| class Block extends Bem { | |
| constructor() { | |
| super(); | |
| this.a = 1; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Bem { | |
| } | |
| // src/common/Block/Block.js | |
| class Block extends Bem { | |
| constructor() { | |
| super(); | |
| this.a = 1; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function combineClasses<T1, T2>(C1, C2): new (...args: any[]) => T1 & T2 { | |
| Object.getOwnPropertyNames(C2.prototype).forEach((name) => { | |
| if (name !== 'constructor') { | |
| C1.prototype[name] = C2.prototype[name]; | |
| } | |
| }); | |
| return Object.setPrototypeOf(C2, C1); | |
| } | |
| function compose<T>(...args: Array<new (...args: any[]) => T>): new (...args: any[]) => T { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export default class Stars extends Component { | |
| async componentDidMount() { | |
| let stars = await githubStars(this.props.repo); | |
| this.setState({ stars }); | |
| } | |
| render({ repo }, { stars=0 }) { | |
| let url = `//github.com/${repo}`; | |
| return ( | |
| <a href={url} class="stars"> | |
| ⭐️ {stars} Stars |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { decl } from 'bem-react-core' | |
| export default decl({ | |
| block: 'Header', | |
| elem: 'Inner', | |
| attrs({ id }) { | |
| return { id } | |
| } | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const naming = require('./pretty-naming'); | |
| const b1 = p('block').m({ m1: 1, m2: 2 }); | |
| const b2 = p('block42').m({ m3: 3 }); | |
| b1.mix(b2); | |
| console.log(b1.stringify()); | |
| // 'block_m1_1 block_m2_2 block42_m3_3' |