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

How to write Block_modName-Elem? #554

Open
ilyasidorchik opened this issue Apr 5, 2020 · 2 comments
Open

How to write Block_modName-Elem? #554

ilyasidorchik opened this issue Apr 5, 2020 · 2 comments

Comments

@ilyasidorchik
Copy link

ilyasidorchik commented Apr 5, 2020

Please, help me get the class of element that changes its style depending on its block.

const block = cn('Block') // 'Block'
block({ modName: true }) // 'Block Block_modName'
block({ modName: true })('Elem') // Error. Type 'String' has no call signatures

Of course I can use cn('Block_modName')('Elem') but the meaning of the package is lost.

@ilyasidorchik ilyasidorchik changed the title How to write Block_modName-Elem? How to write Block_modName-Elem? Apr 5, 2020
@yarastqt
Copy link
Member

yarastqt commented Apr 6, 2020

Hello, it's strange case, u can tell about this?

@ilyasidorchik
Copy link
Author

I knew from the BEM docs that block could have modifier. Also I read that block could have element. So I supposed modified block with element had a place to be.

About my example. I have Link component for a common link. In addition, I want special Link component for a link with more clickable zone around. I named it Link_wrap and add element <u> with classes Link-U Link_wrap-U for underlined words.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants