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

Ported fluid grid component from stache2 #957

Merged
merged 26 commits into from
Aug 16, 2017
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
b876647
Initial commit
Blackbaud-JeffDye Jul 28, 2017
146e999
Undoing whitespace change
Blackbaud-JeffDye Jul 28, 2017
4c30f16
Updated visual test help text
Blackbaud-JeffDye Jul 28, 2017
f5c0b1d
last bit of text
Blackbaud-JeffDye Jul 28, 2017
5468021
Merge remote-tracking branch 'upstream/master' into fluid-grid
Blackbaud-JeffDye Jul 28, 2017
793ec43
Updated screenshot test selector
Blackbaud-JeffDye Jul 28, 2017
6dc0ad1
Updated docs, exports
Blackbaud-JeffDye Jul 28, 2017
498217c
Updating visual test screen widths
Blackbaud-JeffDye Jul 30, 2017
2525240
Newlines, accidental whitespace changes
Blackbaud-JeffDye Jul 30, 2017
3e56d6f
More whitespace...
Blackbaud-JeffDye Jul 30, 2017
9871d6d
Export component classes
Blackbaud-JeffDye Jul 31, 2017
e17253b
Caught issue with ReverseColumnOrder visual test
Blackbaud-JeffDye Jul 31, 2017
a8cd5f1
Merge remote-tracking branch 'upstream/master' into fluid-grid
Blackbaud-JeffDye Aug 1, 2017
fd9a31d
Updated docs
Blackbaud-JeffDye Aug 1, 2017
02729f1
Unused imports are unused
Blackbaud-JeffDye Aug 2, 2017
24bb453
Updating docs
Blackbaud-JeffDye Aug 2, 2017
5899762
Merge branch 'master' into fluid-grid
Blackbaud-SteveBrush Aug 2, 2017
c017df7
Merge remote-tracking branch 'upstream/master' into fluid-grid
Blackbaud-JeffDye Aug 3, 2017
84e5157
Fixed casing on the demo title, merge with master
Blackbaud-JeffDye Aug 3, 2017
268cd57
Merge branch 'fluid-grid' of https://github.com/Blackbaud-JeffDye/sky…
Blackbaud-JeffDye Aug 3, 2017
e509a85
Merge branch 'master' into fluid-grid
Blackbaud-JeffDye Aug 5, 2017
a15f5c2
Docs round 2
Blackbaud-JeffDye Aug 7, 2017
4465cc9
Merge branch 'fluid-grid' of https://github.com/Blackbaud-JeffDye/sky…
Blackbaud-JeffDye Aug 7, 2017
165459d
Missing '.'
Blackbaud-JeffDye Aug 7, 2017
5f96c39
Merge branch 'master' into fluid-grid
Blackbaud-JeffDye Aug 11, 2017
854e600
Merge branch 'master' into fluid-grid
Blackbaud-SteveBrush Aug 15, 2017
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<div id="screenshot-fluid-grid">
<sky-row>
<sky-column screenSmall="4" screenMedium="3" screenLarge="2">
small 4 medium 3 large 2
</sky-column>
<sky-column screenSmall="4" screenMedium="9" screenLarge="8">
small 4 medium 9 large 8
</sky-column>
<sky-column screenSmall="4" screenMedium="12" screenLarge="2">
small 4 medium 12 large 2
</sky-column>
</sky-row>
</div>

<div id="screenshot-fluid-grid-reverse">
<sky-row [reverseColumnOrder]="true">
<sky-column>
should be second/below
</sky-column>
<sky-column>
should be first/on top
</sky-column>
</sky-row>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import {
Component
} from '@angular/core';

@Component({
selector: 'fluid-grid-visual',
templateUrl: './fluid-grid-visual.component.html'
})
export class FluidGridVisualComponent { }
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import { SkyVisualTest } from '../../../config/utils/visual-test-commands';

import { element, by, browser } from 'protractor';

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

it('should display all columns on different rows when on a very small screen', () => {
return SkyVisualTest.setupTest('fluid-grid', 600)
.then(() => {
return SkyVisualTest.compareScreenshot({
screenshotName: 'fluid-grid-screensmallest-differentrows',
selector: '#screenshot-fluid-grid',
checkAccessibility: true
});
});
});

it('should display all columns evenly split on the same row when on a small screen', () => {
return SkyVisualTest.setupTest('fluid-grid', 800)
.then(() => {
return SkyVisualTest.compareScreenshot({
screenshotName: 'fluid-grid-screensmall-evenrow',
selector: '#screenshot-fluid-grid',
checkAccessibility: true
});
});
});

it('should display two on the top row and one on the bottom row when on a medium screen', () => {
return SkyVisualTest.setupTest('fluid-grid', 1100)
.then(() => {
return SkyVisualTest.compareScreenshot({
screenshotName: 'fluid-grid-screenmedium-tworows',
selector: '#screenshot-fluid-grid',
checkAccessibility: true
});
});
});

it('should display all columns distributed unevenly when on a large screen', () => {
return SkyVisualTest.setupTest('fluid-grid', 1400)
.then(() => {
return SkyVisualTest.compareScreenshot({
screenshotName: 'fluid-grid-screenlarge-unevenrow',
selector: '#screenshot-fluid-grid',
checkAccessibility: true
});
});
});

it('should reverse column order with reverseColumnOrder applied', () => {
return SkyVisualTest.setupTest('fluid-grid', 1500)
.then(() => {
return SkyVisualTest.compareScreenshot({
screenshotName: 'fluid-grid-reversecolumnorder',
selector: '#screenshot-fluid-grid-reverse',
checkAccessibility: true
});
});
});
});
1 change: 1 addition & 0 deletions skyux-spa-visual-tests/src/app/fluid-grid/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<fluid-grid-visual></fluid-grid-visual>
1 change: 1 addition & 0 deletions skyux-spa-visual-tests/src/app/home.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export class HomeComponent {
'error',
'fileattachments',
'filter',
'fluid-grid',
'forms',
'grid',
'key-info',
Expand Down
21 changes: 21 additions & 0 deletions src/app/components/demo-components.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,27 @@ export class SkyDemoComponentsService {
];
}
},
{
name: 'Fluid Grid',
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this name property displayed as a header anywhere in the docs? If so, "G" should be lowercase.

icon: 'table',
// tslint:disable-next-line
summary: `Provides a layout grid for creating responsive content.`,
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if this summary property is displayed anywhere in the docs, but do we need "creating" here? I mean, does the grid actually create responsive content? Or does it just display responsive content?

url: '/components/fluid-grid',
getCodeFiles: function () {
return [
{
name: 'fluid-grid.component.html',
fileContents: require('!!raw-loader!./fluid-grid/fluid-grid-demo.component.html')
},
{
name: 'fluid-grid-demo.component.ts',
fileContents: require('!!raw-loader!./fluid-grid/fluid-grid-demo.component.ts'),
componentName: 'SkyFluidGridDemoComponent',
bootstrapSelector: 'sky-fluid-grid-demo'
}
];
}
},
{
name: 'Form',
icon: 'keyboard-o',
Expand Down
160 changes: 160 additions & 0 deletions src/app/components/fluid-grid/fluid-grid-demo.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
<div class="highlight-columns">
<sky-row>
<sky-column screenSmall="1">
small="1"
</sky-column>
<sky-column screenSmall="1">
small="1"
</sky-column>
<sky-column screenSmall="1">
small="1"
</sky-column>
<sky-column screenSmall="1">
small="1"
</sky-column>
<sky-column screenSmall="1">
small="1"
</sky-column>
<sky-column screenSmall="1">
small="1"
</sky-column>
<sky-column screenSmall="1">
small="1"
</sky-column>
<sky-column screenSmall="1">
small="1"
</sky-column>
<sky-column screenSmall="1">
small="1"
</sky-column>
<sky-column screenSmall="1">
small="1"
</sky-column>
<sky-column screenSmall="1">
small="1"
</sky-column>
<sky-column screenSmall="1">
small="1"
</sky-column>
</sky-row>

<sky-row>
<sky-column screenSmall="2">
small="2"
</sky-column>
<sky-column screenSmall="2">
small="2"
</sky-column>
<sky-column screenSmall="2">
small="2"
</sky-column>
<sky-column screenSmall="2">
small="2"
</sky-column>
<sky-column screenSmall="2">
small="2"
</sky-column>
<sky-column screenSmall="2">
small="2"
</sky-column>
</sky-row>

<sky-row>
<sky-column screenSmall="3">
small="3"
</sky-column>
<sky-column screenSmall="3">
small="3"
</sky-column>
<sky-column screenSmall="3">
small="3"
</sky-column>
<sky-column screenSmall="3">
small="3"
</sky-column>
</sky-row>

<sky-row>
<sky-column screenSmall="4">
small="4"
</sky-column>
<sky-column screenSmall="4">
small="4"
</sky-column>
<sky-column screenSmall="4">
small="4"
</sky-column>
</sky-row>

<sky-row>
<sky-column screenSmall="5">
small="5"
</sky-column>
<sky-column screenSmall="7">
small="7"
</sky-column>
</sky-row>

<sky-row>
<sky-column screenSmall="6">
small="6"
</sky-column>
<sky-column screenSmall="6">
small="6"
</sky-column>
</sky-row>

<sky-row>
<sky-column screenSmall="8">
small="8"
</sky-column>
<sky-column screenSmall="4">
small="4"
</sky-column>
</sky-row>

<sky-row>
<sky-column screenSmall="9">
small="9"
</sky-column>
<sky-column screenSmall="3">
small="3"
</sky-column>
</sky-row>

<sky-row>
<sky-column screenSmall="10">
small="10"
</sky-column>
<sky-column screenSmall="2">
small="2"
</sky-column>
</sky-row>

<sky-row>
<sky-column screenSmall="11">
small="11"
</sky-column>
<sky-column screenSmall="1">
small="1"
</sky-column>
</sky-row>

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

<sky-row [reverseColumnOrder]="true">
<sky-column screenSmall="9">
First column
</sky-column>
<sky-column screenSmall="3">
Second column
</sky-column>
</sky-row>
</div>
15 changes: 15 additions & 0 deletions src/app/components/fluid-grid/fluid-grid-demo.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Component } from '@angular/core';

@Component({
selector: 'sky-fluid-grid-demo',
templateUrl: './fluid-grid-demo.component.html',
styles: [`
.highlight-columns .sky-column {
background-color: #97eced;
border: 1px solid #56e0e1;
overflow-wrap: break-word;
}`]
})
export class SkyFluidGridDemoComponent {

}
29 changes: 29 additions & 0 deletions src/app/components/fluid-grid/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<sky-demo-page title="Fluid Grid">
<sky-demo-page-summary>
The Grid components provide a 12 column layout grid for organizing content for all device sizes. The grid consists of <code>sky-row</code> and <code>sky-column</code> tags. Every column must be contained in a row. Each column can have multiple properties specified in order to handle different behavior for each screen size. Below the width of 768px (small screen) all elements will be displayed in a single row.
</sky-demo-page-summary>

<sky-demo-page-properties sectionHeading="Sky row properties">
<sky-demo-page-property propertyName="reverseColumnOrder" defaultValue="false" isOptional="true">
Reverses the display order for the child columns when set to <code>true</code>.
Copy link
Contributor

Choose a reason for hiding this comment

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

What designates a column as a child column? I feel like I'm missing something here. I thought this property would change the order (from left to right) of the columns in the grid so that whatever would have been last (far right) will be first (far left) with the other columns changing likewise (with the middle column staying right where it was if you have an odd number of columns). But the fact that we are referring to child columns makes me wonder if this property applies to some subset of the columns or if I'm just not following this at all.

Also, how is the original display order determined? Is there a default order? If so, should we specify that here? If not, should we explain how the unreversed display order is determined?

On a more minor wording note, I'd tweak the description slightly to follow the wording pattern we usually use with Boolean properties: "Indicates whether to reverse the display for for the child columns."

</sky-demo-page-property>

</sky-demo-page-properties>
<sky-demo-page-properties sectionHeading="Sky column properties">
<sky-demo-page-property propertyName="screenSmall" isOptional="true">
The number of columns (1-12) the element will use on a small screen (768px)
</sky-demo-page-property>
<sky-demo-page-property propertyName="screenMedium" isOptional="true">
The number of columns (1-12) the element will use on a medium screen (992px).
</sky-demo-page-property>
<sky-demo-page-property propertyName="screenLarge" isOptional="true">
The number of columns (1-12) the element will use on a large screen (1200px).
</sky-demo-page-property>
</sky-demo-page-properties>

<sky-demo-page-example>
<sky-fluid-grid-demo></sky-fluid-grid-demo>
<sky-demo-page-code demoName="Fluid Grid"></sky-demo-page-code>
</sky-demo-page-example>

</sky-demo-page>
2 changes: 2 additions & 0 deletions src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { SkyEmailValidationModule } from './modules/email-validation';
import { SkyErrorModule } from './modules/error';
import { SkyFileAttachmentsModule } from './modules/fileattachments';
import { SkyFilterModule } from './modules/filter';
import { SkyFluidGridModule } from './modules/fluid-grid/fluid-grid.module';
import { SkyGridModule } from './modules/grid';
import { SkyKeyInfoModule } from './modules/key-info';
import { SkyLabelModule } from './modules/label';
Expand Down Expand Up @@ -64,6 +65,7 @@ import { SkyWaitModule } from './modules/wait';
SkyErrorModule,
SkyFileAttachmentsModule,
SkyFilterModule,
SkyFluidGridModule,
SkyGridModule,
SkyKeyInfoModule,
SkyLabelModule,
Copy link
Contributor

Choose a reason for hiding this comment

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

Here, also export the module and components so that consumers have access through core. You can see examples below

Expand Down
1 change: 1 addition & 0 deletions src/modules/fluid-grid/column.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<ng-content></ng-content>
21 changes: 21 additions & 0 deletions src/modules/fluid-grid/column.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
@import '../../scss/_variables';
@import '../../scss/_mixins';

:host.sky-column {
padding-right: $sky-fluid-grid-gutter;
padding-left: $sky-fluid-grid-gutter;
width: 100%;
min-height: 1px;
}

@media (min-width: $sky-screen-sm-min) {
@include create_columns(sm);
}

@media (min-width: $sky-screen-md-min) {
@include create_columns(md);
}

@media (min-width: $sky-screen-lg-min) {
@include create_columns(lg);
}
Loading