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

Please Don't Use Field _prefixCls. #40

Closed
LinboLen opened this issue Aug 16, 2017 · 5 comments
Closed

Please Don't Use Field _prefixCls. #40

LinboLen opened this issue Aug 16, 2017 · 5 comments

Comments

@LinboLen
Copy link
Contributor

LinboLen commented Aug 16, 2017

I'm submitting a...


[ ] Bug report  
[x] Feature request
[ ] Documentation issue or request
[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Support request => Please do not submit support request here

Current behavior

@Component({
  selector     : 'nz-button-group',
  encapsulation: ViewEncapsulation.None,
  template     : `
    <div [ngClass]="_classMap" #groupWrapper>
      <ng-content></ng-content>
    </div>
  `,
  styleUrls    : []
})
export class NzButtonGroupComponent implements AfterContentInit {
  _size: NzButtonGroupSize;
  _prefixCls = 'ant-btn-group';
  _sizeMap = { large: 'lg', small: 'sm' };
  @ViewChild('groupWrapper') _groupWrapper: ElementRef;

Expected behavior

please don't use _prefixCls = 'ant-btn-group';

Minimal reproduction of the problem with instructions

What is the motivation / use case for changing the behavior?

  • class filed will consume memory when instance, simplify field will benefit performance.

  • UI framework/component, should be welcome to developer just using COPY/PASTE command, simplify field will lead developer just focus on data associate field whitch commonly related to binding data.

  • ui class name, html tag should simple behave as literal exactly. please use string function or string operator as less as possible. (developer can just find or replace what he need globally)

  • i see some _prefixClswith string combine style. like [ant-tag-${this.nzColor}] : isPresetColor,this sames like less/scss problem. the real effect style should be ant-tag someofngcolor

fininally, i insist on simplify field. and _prefixCls field should be removed.

Environment



Angular version: X.Y.Z

ng-zorro-antd version: X.Y.Z

Browser:

- [ ] Chrome (desktop) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] IE version XX

For Tooling issues:
- Node version: XX  
- Platform:  

Others:

@LinboLen
Copy link
Contributor Author

I'm trying to make pull request this weekend.

@vthinkxie
Copy link
Member

@LinboLen
to be discussed, please not pr yet.
thanks.

@LinboLen
Copy link
Contributor Author

LinboLen commented Aug 18, 2017

thanks, i can get an right voice from your team. i have to deep custom ng-zorro with some featured component. preview of style break change will adjust weight of my work feature focus on.

closed

@vthinkxie
Copy link
Member

_prefixCls class is sync with ant design it self.
I don't think it will often change, don't worry about it too much.

@lock
Copy link

lock bot commented Feb 19, 2019

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked as resolved and limited conversation to collaborators Feb 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants