This repository has been archived by the owner on Jan 6, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 771
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(fxLayoutGap): add gutter functionality to layout-gap
* Apply negative margin and positive padding as browser-agnostic hack for grid gutter * The new feature is activated by appending `grid` to any `fxLayoutGap` input, e.g. `fxLayoutGap="10px grid"`
- Loading branch information
1 parent
3cfafd1
commit 84ca5c3
Showing
6 changed files
with
207 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/apps/demo-app/src/app/layout/layout-gap/layout-gap.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { LayoutGapComponent } from './layout-gap.component'; | ||
|
||
describe('LayoutGapComponent', () => { | ||
let component: LayoutGapComponent; | ||
let fixture: ComponentFixture<LayoutGapComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ LayoutGapComponent ] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(LayoutGapComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
70 changes: 70 additions & 0 deletions
70
src/apps/demo-app/src/app/layout/layout-gap/layout-gap.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import {Component} from '@angular/core'; | ||
|
||
const DIRECTIONS = ['row', 'row-reverse', 'column', 'column-reverse']; | ||
|
||
@Component({ | ||
selector: 'demo-layout-gap', | ||
template: ` | ||
<mat-card class="card-demo"> | ||
<mat-card-title><a href="" target="_blank">Layout Gap</a></mat-card-title> | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
CaerusKaru
Author
Member
|
||
<mat-card-subtitle>Using 'fxLayoutGap' to create a grid-like layout | ||
</mat-card-subtitle> | ||
<mat-card-content class="large"> | ||
<div fxFlexFill> | ||
<div fxFlex | ||
[fxLayout]="direction + ' wrap'" | ||
fxLayoutGap="10px grid" | ||
style="cursor: pointer;" | ||
(click)="toggleDirection()"> | ||
<div fxFlex="25"> | ||
<div class="one" fxFlexFill fxLayoutAlign="center center"> | ||
A | ||
</div> | ||
</div> | ||
<div fxFlex="25"> | ||
<div class="two" fxFlexFill fxLayoutAlign="center center"> | ||
B | ||
</div> | ||
</div> | ||
<div fxFlex="25"> | ||
<div class="three" fxFlexFill fxLayoutAlign="center center"> | ||
C | ||
</div> | ||
</div> | ||
<div fxFlex="25"> | ||
<div class="four" fxFlexFill fxLayoutAlign="center center"> | ||
D | ||
</div> | ||
</div> | ||
<div fxFlex="25"> | ||
<div class="five" fxFlexFill fxLayoutAlign="center center"> | ||
E | ||
</div> | ||
</div> | ||
<div fxFlex="25"> | ||
<div class="six" fxFlexFill fxLayoutAlign="center center"> | ||
F | ||
</div> | ||
</div> | ||
<div fxFlex="25"> | ||
<div class="seven" fxFlexFill fxLayoutAlign="center center"> | ||
G | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</mat-card-content> | ||
<mat-card-footer class="bottomPad"> | ||
<div class="hint"></div> | ||
</mat-card-footer> | ||
</mat-card> | ||
` | ||
}) | ||
export class LayoutGapComponent { | ||
direction = 'row'; | ||
|
||
toggleDirection() { | ||
const next = (DIRECTIONS.indexOf(this.direction) + 1 ) % DIRECTIONS.length; | ||
this.direction = DIRECTIONS[next]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@CaerusKaru, I know this has already been merged, but... why do we have an anchor tag here? Was the building process supposed to add any useful link? Or is it a placeholder for future use? At the online demo app (https://tburleson-layouts-demos.firebaseapp.com) it opens a new browser tab with the same content of the original one because it points to https://tburleson-layouts-demos.firebaseapp.com.