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

Add responsive Order classes for Flexbox reordering #21594

Closed
wants to merge 7 commits into from

Conversation

jhechtf
Copy link

@jhechtf jhechtf commented Jan 7, 2017

Add in dynamic classes that change the order:... CSS property for flex columns. For example, using the following HTML:

<section class="container-fluid bg-helms-light">
  <div class="row gradient">
    <div class="col-xs-12 order-xs-2 order-md-1 col-md-8" style="">
      <div class="display-3  text-xs-center mb-2">Lorem ipsum dolor sit amet.</div>
      <div class="h3  text-xs-center">Lorem ipsum dolor.</div>
      <p class="lead">Lorem ipsum. <em><u>Lorem ipsum.</u></em>.</p>
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Optio ipsum eum recusandae provident perspiciatis minima explicabo deleniti delectus tenetur aut, ullam libero eveniet nulla architecto ea, inventore sapiente, perferendis molestias.
      </p>
    </div>
    <div class="col-xs-12 order-xs-1 order-md-2 col-md-4">
      <img src="http://placehold.it/400?text=Students 1" alt="Placeholder" style="height:100%;width:100%;">
    </div>
  </div>
  <div class="row bg-helms-dark gradient-white">
    <div class="col-md-4 col-xs-12">
      <img src="http://placehold.it/400?text=Students 2" style="height:100%;width:100%;" alt="Placeholder 2">
    </div>
    <div class="col-md-8 col-xs-12 p-0 pt-1">
      <div class="display-1 text-xs-center">Lorem ipsum dolor sit.</div>
      <p class="h3">Lorem ipsum dolor sit amet, consectetur adipisicing elit....</p>
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Vel magnam repudiandae beatae, suscipit aliquid a aut quos ea quas quo sit eligendi, dolorem excepturi modi.</p>
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Animi quod, laudantium laborum odio tempore praesentium placeat quaerat consectetur, molestiae quas eius rem voluptatum vel eum incidunt, error iure minus maxime.
      </p>
    </div>
  </div>
  <div class="row gradient">
    <div class="col-xs-12">
      <div class="display-3 text-xs-center">Lorem ipsum dolor sit amet, consectetur:
      </div>
      <h3>
					Lorem ipsum dolor sit amet, consectetur adipisicing elit. Illum, atque.
				</h3>
      <p class="lead">Lorem ipsum dolor sit amet, consectetur.</p>
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dicta facere consequuntur, dolor repellat sunt facilis.</p>
      <h5>Lorem ipsum dolor sit amet, consectetur adipisicing elit. </h5>
      <ol>
        <li>Lorem ipsum.</li>
        <li>Ea, autem.</li>
        <li>Accusamus, labore.</li>
      </ol>

    </div>
  </div>
</section>

Results in two fairly different views:

Desktop / Full View

Figure 1

Mobile / Small View

Figure 2

Without Order Classes

Figure3

scss/_grid.scss Outdated
}
}
}
}

Choose a reason for hiding this comment

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

Files should end with a trailing newline

scss/_grid.scss Outdated
@@ -50,3 +50,13 @@
@if $enable-grid-classes {
@include make-grid-columns();
}

@each $size, $pixels in $grid-breakpoints {
@include media-breakpoint-up($size) {

Choose a reason for hiding this comment

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

Line should be indented with spaces, not tabs

@mdo
Copy link
Member

mdo commented Jan 8, 2017

You'll need to remove the dist files and fix the indentation before we can review or merge this.

@bardiharborow
Copy link
Member

bardiharborow commented Jan 8, 2017

What mdo meant was to not change the dist files in your PR, rather than to remove them completely. Run this to recover:

git reset 65ffb1c
git checkout dist/
git add scss/_grid.scss
git commit -m 'Added flexbox .order-* classes.'
git push -f

@mdo mdo added this to the v4.1 ideas milestone Jan 16, 2017
scss/_grid.scss Outdated
order:$i;
}
}
@else {

Choose a reason for hiding this comment

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

@else should be placed on same line as previous curly brace

scss/_grid.scss Outdated
@for $i from 1 to $grid-columns {
@if $size=='xs' {
.order-#{$i}{
order:$i;

Choose a reason for hiding this comment

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

Colon after property should be followed by at least one space

scss/_grid.scss Outdated
@include media-breakpoint-up($size) {
@for $i from 1 to $grid-columns {
@if $size=='xs' {
.order-#{$i}{

Choose a reason for hiding this comment

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

Opening curly brace { should be preceded by one space

scss/_grid.scss Outdated
$pixels in $grid-breakpoints {
@include media-breakpoint-up($size) {
@for $i from 1 to $grid-columns {
@if $size=='xs' {

Choose a reason for hiding this comment

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

$size=='xs' should be written with a single space on each side of the operator: $size == 'xs'
Prefer double-quoted strings

@alex88
Copy link

alex88 commented Jun 25, 2017

This would be a very nice thing to have

@mdo mdo modified the milestones: v4.0.0-beta, v4.1 ideas Jun 30, 2017
@mdo
Copy link
Member

mdo commented Jun 30, 2017

This was addressed in #22942.

@mdo mdo closed this Jun 30, 2017
@mdo mdo added this to Shipped in v4 Beta 1 Jun 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
v4 Beta 1
Shipped
Development

Successfully merging this pull request may close these issues.

None yet

6 participants