-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #270 from e-picsa/feat-custom-drawing
feat(budget-tool): custom card drawing input
- Loading branch information
Showing
18 changed files
with
373 additions
and
28 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
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
11 changes: 7 additions & 4 deletions
11
apps/picsa-tools/budget-tool/src/app/components/card/card-new/card-new-dialog.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 |
---|---|---|
@@ -1,10 +1,13 @@ | ||
<mat-card appearance="outlined" mat-elevation-z4 class="budget-card selectable"> | ||
<!-- <mat-card appearance="outlined" mat-elevation-z4 class="budget-card selectable"> | ||
<budget-card-image [card]="card"></budget-card-image> | ||
<div class="card-title">{{ card.label | translate }}</div> | ||
</mat-card> | ||
<mat-form-field> | ||
</mat-card> --> | ||
|
||
<picsa-custom-drawing (onChange)="setBudgetDrawing($event)"></picsa-custom-drawing> | ||
<mat-form-field class="label-input"> | ||
<mat-label>{{'Card Label' | translate}}</mat-label> | ||
<input matInput [(ngModel)]="card.label" /> | ||
</mat-form-field> | ||
<button mat-stroked-button (click)="save()" [disabled]="card.label === ''" style="margin-top: 1em; width: 70%"> | ||
<button mat-stroked-button (click)="save()" [disabled]="!card.label || !imgData" style="margin-top: 1em; width: 70%"> | ||
<mat-icon>check</mat-icon>{{ 'Save' | translate }} | ||
</button> |
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 |
---|---|---|
|
@@ -11,3 +11,7 @@ | |
background: #dcdcdc; | ||
overflow: auto; | ||
} | ||
.label-input { | ||
width: 100%; | ||
margin-top: 1rem; | ||
} |
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
13 changes: 7 additions & 6 deletions
13
libs/shared/src/features/data-table/data-table.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
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,39 @@ | ||
<div class="dialog-container"> | ||
<div class="edit-buttons"> | ||
<button mat-stroked-button (click)="undoSvgStroke()"><mat-icon>undo</mat-icon>{{ 'Undo' | translate }}</button> | ||
<button mat-stroked-button (click)="redoSvgStroke()"><mat-icon>redo</mat-icon>{{ 'Redo' | translate }}</button> | ||
<button mat-stroked-button style="margin-left: auto" (click)="clearDraw()">{{ 'Clear All' | translate }}</button> | ||
</div> | ||
<div class="svg-container" [style.width]="size() + 'px'" [style.height]="size() + 'px'"> | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
[attr.viewBox]="viewbox()" | ||
[attr.height]="size()" | ||
[attr.width]="size()" | ||
#svgElement | ||
(pointerdown)="handlePointerDown($event)" | ||
(pointermove)="handlePointerMove($event)" | ||
(mouseup)="handlePointerUp()" | ||
(pointerup)="handlePointerUp()" | ||
style="touch-action: none" | ||
> | ||
<!-- Previously rendered segments --> | ||
@for(segment of segments; track segment.id){ | ||
<path [attr.d]="segment.path()" [id]="segment.id" /> | ||
} | ||
|
||
<!-- Active segment --> | ||
@if(activeSegment.path()){ | ||
<path [attr.d]="activeSegment.path()" [id]="activeSegment.id" /> | ||
} | ||
</svg> | ||
<!-- Draw Prompt Logo --> | ||
@if(segments.length===0 && !activeSegment.path()){ | ||
<div class="draw-logo"> | ||
<mat-icon>draw</mat-icon> | ||
<div>{{ 'Draw Here' | translate }}</div> | ||
</div> | ||
|
||
} | ||
</div> | ||
</div> |
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,28 @@ | ||
.dialog-container { | ||
text-align: center; | ||
} | ||
.svg-container { | ||
border: 1px solid #eeeeee; | ||
border-radius: 4px; | ||
box-sizing: border-box; | ||
position: relative; | ||
overflow: hidden; | ||
} | ||
.draw-logo { | ||
position: absolute; | ||
top: 50%; | ||
left: 50%; | ||
transform: translate(-50%, -50%); | ||
color: var(--color-light); | ||
mat-icon { | ||
font-size: 48px; | ||
height: 48px; | ||
width: 48px; | ||
} | ||
} | ||
|
||
.edit-buttons { | ||
display: flex; | ||
gap: 8px; | ||
margin-bottom: 8px; | ||
} |
22 changes: 22 additions & 0 deletions
22
libs/shared/src/features/drawing/drawing.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,22 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { PicsaDrawingComponent } from './drawing.component'; | ||
|
||
describe('DrawingComponent', () => { | ||
let component: PicsaDrawingComponent; | ||
let fixture: ComponentFixture<PicsaDrawingComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [PicsaDrawingComponent], | ||
}).compileComponents(); | ||
|
||
fixture = TestBed.createComponent(PicsaDrawingComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
Oops, something went wrong.