Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Added x-small breakpoint for fluid-grid #1088

Merged
merged 1 commit into from
Sep 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@
</sky-row>
</div>

<div id="screenshot-fluid-grid-xsmall">
<sky-row>
<sky-column screenXSmall="6">
xsmall 6
</sky-column>
<sky-column screenXSmall="6">
xsmall 6
</sky-column>
</sky-row>
</div>

<div id="screenshot-fluid-grid-reverse">
<sky-row [reverseColumnOrder]="true">
<sky-column screenSmall="6">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { SkyVisualTest } from '../../../config/utils/visual-test-commands';

describe('Fluid grid', () => {
fdescribe('Fluid grid', () => {

it('should display all columns on different rows when on a very small screen', () => {
it('should handle very small screens', () => {
return SkyVisualTest.setupTest('fluid-grid', 600)
.then(() => {
return SkyVisualTest.compareScreenshot({
screenshotName: 'fluid-grid-screensmallest-differentrows',
selector: '#screenshot-fluid-grid',
screenshotName: 'fluid-grid-screenxsmall',
selector: '#screenshot-fluid-grid-xsmall',
checkAccessibility: true
});
});
Expand Down
8 changes: 4 additions & 4 deletions src/app/components/fluid-grid/fluid-grid-demo.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,11 @@
</sky-row>

<sky-row>
<sky-column screenSmall="8" screenMedium="9" screenLarge="10">
small="8" medium="9" large="10"
<sky-column screenXSmall="6" screenSmall="8" screenMedium="9" screenLarge="10">
screenXSmall="6" small="8" medium="9" large="10"
</sky-column>
<sky-column screenSmall="4" screenMedium="3" screenLarge="2">
small="4" medium="3" large="2"
<sky-column screenXSmall="6" screenSmall="4" screenMedium="3" screenLarge="2">
screenXSmall="6" small="4" medium="3" large="2"
</sky-column>
</sky-row>

Expand Down
7 changes: 5 additions & 2 deletions src/app/components/fluid-grid/index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<sky-demo-page pageTitle="Fluid grid">
<sky-demo-page-summary>
The fluid grid component provides a responsive 12-column layout to organize content for all device sizes. The fluid grid consists of <code>sky-row</code> and <code>sky-column</code> tags. You place column elements in row elements, and then you can specify how much of the layout to use for each column element on small, medium, and large screens. For extra small screens (less than 768px), the fluid grid automatically stacks columns vertically across the entire 12-column layout.
The fluid grid component provides a responsive 12-column layout to organize content for all device sizes. The fluid grid consists of <code>sky-row</code> and <code>sky-column</code> tags. You place column elements in row elements, and then you can specify how much of the layout to use for each column element on extra-small, small, medium, and large screens.
</sky-demo-page-summary>

<sky-demo-page-properties sectionHeading="Sky row properties">
Expand All @@ -10,8 +10,11 @@

</sky-demo-page-properties>
<sky-demo-page-properties sectionHeading="Sky column properties">
<sky-demo-page-property propertyName="screenXSmall" isOptional="true">
Specifies the number of columns (1-12) to use for the element on extra-small screens (less than 768px). If you do not specify a value, the fluid grid displays the column at 100% width.
</sky-demo-page-property>
<sky-demo-page-property propertyName="screenSmall" isOptional="true">
Specifies the number of columns (1-12) to use for the element on small screens (768-991px). If you do not specify a value, the fluid grid displays the element vertically across the entire layout.
Specifies the number of columns (1-12) to use for the element on small screens (768-991px). If you do not specify a value, the element inherits the screenXSmall value.
</sky-demo-page-property>
<sky-demo-page-property propertyName="screenMedium" isOptional="true">
Specifies the number of columns (1-12) to use for the element on medium screens (992-1199px). If you do not specify a value, the element inherits the screenSmall value.
Expand Down
2 changes: 2 additions & 0 deletions src/modules/fluid-grid/column.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
min-height: 1px;
}

@include create_columns(xs);

@media (min-width: $sky-screen-sm-min) {
@include create_columns(sm);
}
Expand Down
2 changes: 2 additions & 0 deletions src/modules/fluid-grid/column.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ describe('SkyColumnComponent', () => {
});

it('should add a class for small, medium, and large breakpoints', () => {
component.screenXSmall = 1;
component.screenSmall = 1;
component.screenMedium = 2;
component.screenLarge = 5;
fixture.detectChanges();
expect(element.className).toContain('sky-column-xs-1');
expect(element.className).toContain('sky-column-sm-1');
expect(element.className).toContain('sky-column-md-2');
expect(element.className).toContain('sky-column-lg-5');
Expand Down
7 changes: 7 additions & 0 deletions src/modules/fluid-grid/column.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import {
styleUrls: ['./column.component.scss']
})
export class SkyColumnComponent implements OnInit {
@Input()
public screenXSmall: number;

@Input()
public screenSmall: number;

Expand All @@ -28,6 +31,10 @@ export class SkyColumnComponent implements OnInit {
'sky-column'
];

if (this.screenXSmall) {
classnames.push(`sky-column-xs-${this.screenXSmall}`);
}

if (this.screenSmall) {
classnames.push(`sky-column-sm-${this.screenSmall}`);
}
Expand Down