Skip to content

refactor spinners SCSS#27655

Closed
midzer wants to merge 1 commit intotwbs:spinnerfrom
midzer:spinner
Closed

refactor spinners SCSS#27655
midzer wants to merge 1 commit intotwbs:spinnerfrom
midzer:spinner

Conversation

@midzer
Copy link
Copy Markdown
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
Copy link
Copy Markdown
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

Comment thread scss/_spinners.scss
width: $spinner-width-sm;
height: $spinner-height-sm;
border-width: $spinner-border-width-sm;
&.spinner-sm {
Copy link
Copy Markdown
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
Copy Markdown
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

Comment thread scss/_spinners.scss
}

.spinner-border {
%spinner {
Copy link
Copy Markdown
Member

@MartijnCuppens MartijnCuppens Nov 12, 2018

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
Copy Markdown
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
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.

4 participants