Last active
December 27, 2018 07:49
-
-
Save awinogradov/f267163d1aa1e01439773d9c77b6a2ed to your computer and use it in GitHub Desktop.
React & BEM: one more collaboration. [email protected]
This file contains 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: 'App', | |
elem: 'Header', | |
attrs: { | |
role: 'heading' | |
}, | |
content() { | |
return 'я заголовок'; | |
} | |
}); |
This file contains 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: 'App', | |
elem: 'Header', | |
tag: 'h1', | |
attrs() { | |
return { | |
...this.__base(...arguments), | |
'aria-level': 1 | |
}, | |
}, | |
content() { | |
return `А ${this.__base(...arguments)} на десктопах превращаюсь в h1`; | |
} | |
}); |
This file contains 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: 'App', | |
elem: 'Header', | |
tag: 'h2', | |
content() { | |
return `А ${this.__base(...arguments)} на тачах`; | |
} | |
}); |
This file contains 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 ReactDomServer from 'react-dom/server'; | |
import AppHeader from 'b:App e:Header'; | |
ReactDomServer.renderToStaticMarkup(<AppHeader />); |
This file contains 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
<h1 class="App-Header" role="heading" aria-level="1">A я заголовок на десктопах превращаюсь в h1</h2> |
This file contains 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
<h2 class="App-Header" role="heading">я заголовок на тачах</h2> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment