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

Elements mixes. How to? #442

Closed
awinogradov opened this issue Jun 10, 2019 · 2 comments
Closed

Elements mixes. How to? #442

awinogradov opened this issue Jun 10, 2019 · 2 comments

Comments

@awinogradov
Copy link
Member

Imagine we have a component Suggest

const cnSuggest = cn('Suggest');

export cont Suggest = props => 
  <div className={cnSuggest(null, [props.className])}>
     <div className={cnSuggest('Logo')} />
  </div>

In project we want to customize Suggest.

<Suggest className="MyMixedSelector" />

But, if you want to cutomize some elements...

.MyMixedSelector .Suggest-Logo {}

How to avoid this?

@belozer
Copy link
Member

belozer commented Jun 10, 2019

I had a similar thing... But on bemxjst.

const cnSuggest = cn('Suggest');

export cont Suggest = props => 
  <div className={cnSuggest(null, [props.className])}>
     <div className={cnSuggest('Logo', null, [props.mixes.Logo])} />
  </div>
const SuggestMixes = { Logo: 'CustomMixForElem' }
<Suggest className="MyMixedSelector" mixes={SuggestMixes} />

or

<Suggest className="MyMixedSelector" LogoMix="CustomMixForElem" />
.CustomMixForElem {}

Thus, we make an additional api for the block. IMHO, external block should not know about the elements of the child block. The API allows you to make some elements public.

@yarastqt
Copy link
Member

Закрываю этот ишьюс, т.к. данная проблема нужна была в первую очередь для использования css-modules, решение этой проблемы давайте дальше обсуждать тут — #545.

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

No branches or pull requests

3 participants