-
Notifications
You must be signed in to change notification settings - Fork 470
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* adding background grid guide, missing cleanup * cleanup * add unit test, use constants for gap * solved conflicts * extended grid to cover all the grid stack * using constant for columns padding * reduce margin between columns * reduce margin between columns * remove unnecessary variable
- Loading branch information
1 parent
7f1160a
commit 92be5d2
Showing
9 changed files
with
113 additions
and
28 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
...ts/template-builder-background-columns/template-builder-background-columns.component.html
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,3 @@ | ||
<div class="background-columns" [ngStyle]="{ gap: gridStackGap }"> | ||
<div class="column" *ngFor="let _ of columnList" data-testClass="column"></div> | ||
</div> |
17 changes: 17 additions & 0 deletions
17
...ts/template-builder-background-columns/template-builder-background-columns.component.scss
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,17 @@ | ||
@use "variables" as *; | ||
|
||
$columns-padding: 3.2rem; | ||
|
||
.background-columns { | ||
height: 100%; | ||
width: 100%; | ||
grid-template-columns: repeat(12, minmax(0, 1fr)); | ||
display: grid; | ||
padding: 0 $columns-padding 0 $columns-padding; | ||
position: absolute; | ||
} | ||
|
||
.column { | ||
height: 100%; | ||
background-color: $color-palette-gray-200; | ||
} |
30 changes: 30 additions & 0 deletions
30
...template-builder-background-columns/template-builder-background-columns.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,30 @@ | ||
import { createHostFactory, SpectatorHost } from '@ngneat/spectator/jest'; | ||
|
||
import { NgFor, NgStyle } from '@angular/common'; | ||
import { By } from '@angular/platform-browser'; | ||
|
||
import { TemplateBuilderBackgroundColumnsComponent } from './template-builder-background-columns.component'; | ||
|
||
describe('TemplateBuilderBackgroundColumnsComponent', () => { | ||
let spectator: SpectatorHost<TemplateBuilderBackgroundColumnsComponent>; | ||
|
||
const createHost = createHostFactory({ | ||
component: TemplateBuilderBackgroundColumnsComponent, | ||
imports: [NgFor, NgStyle] | ||
}); | ||
|
||
beforeEach(() => { | ||
spectator = createHost( | ||
`<dotcms-template-builder-background-columns></dotcms-template-builder-background-columns>` | ||
); | ||
}); | ||
|
||
it('should create the component', () => { | ||
expect(spectator.component).toBeTruthy(); | ||
}); | ||
|
||
it('should have 12 columns', () => { | ||
const columns = spectator.debugElement.queryAll(By.css('[data-testclass="column"]')); | ||
expect(columns.length).toEqual(12); | ||
}); | ||
}); |
17 changes: 17 additions & 0 deletions
17
...ents/template-builder-background-columns/template-builder-background-columns.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,17 @@ | ||
import { NgFor, NgStyle } from '@angular/common'; | ||
import { ChangeDetectionStrategy, Component } from '@angular/core'; | ||
|
||
import { GRID_STACK_MARGIN, GRID_STACK_UNIT } from '../../utils/gridstack-options'; | ||
|
||
@Component({ | ||
selector: 'dotcms-template-builder-background-columns', | ||
templateUrl: './template-builder-background-columns.component.html', | ||
styleUrls: ['./template-builder-background-columns.component.scss'], | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
standalone: true, | ||
imports: [NgFor, NgStyle] | ||
}) | ||
export class TemplateBuilderBackgroundColumnsComponent { | ||
readonly columnList = [].constructor(12); | ||
readonly gridStackGap = `${GRID_STACK_MARGIN * 2}${GRID_STACK_UNIT}`; | ||
} |
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
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