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

refactor spinners SCSS #27655

Closed
wants to merge 1 commit into from
Closed

refactor spinners SCSS #27655

wants to merge 1 commit into from

Conversation

midzer
Copy link
Contributor

@midzer midzer commented Nov 11, 2018

Hi all,

latest SCSS code from #22960 did not work for me on spinner -sm classes.

So I went along and refactored a little bit:

  • introduce base class %spinner which spinner-border and spinner-grow both extend
  • introduce spinner-sm modifier class which is used in combination with spinner-border and spinner-grow to make small spinners, this is the way bootstrap treats other classes as well
  • rename both @keyframes to save more byte

Any feedback is heavily welcome.
Have a nice weekend (or start in the week)
midzer

@midzer midzer requested a review from a team as a code owner November 11, 2018 20:01
@XhmikosR XhmikosR added this to Inbox in v4.2 via automation Nov 11, 2018
Copy link
Member

@MartijnCuppens MartijnCuppens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't change the modifier classes like that without changing the

width: $spinner-width-sm;
height: $spinner-height-sm;
border-width: $spinner-border-width-sm;
&.spinner-sm {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not use the & here, we don't do that for other modifiers, eg .btn-lg:

.btn-lg {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, the class is not correct

}

.spinner-border {
%spinner {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Watch out with extends, you idea was probably to generate less code, but with this technique, you've added 2 extra selectors. I would prefer to see a mixin instead, but don't know if @mdo also agrees?

@mdo
Copy link
Member

mdo commented Nov 12, 2018

I left a reply to your comment in #22960 about this—we won't be changing to an extend based approach as it adds more selectors. Plus, you've changed the selectors here, which are fine as-is with the base class and modifier classes approach. Thanks though :).

@mdo mdo closed this Nov 12, 2018
@XhmikosR XhmikosR removed this from Inbox in v4.2 Nov 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants