Skip to content

Commit

Permalink
updated form spacing and mobile (#285)
Browse files Browse the repository at this point in the history
* updated form spacing and mobile

* fixed spacing
  • Loading branch information
Botosio authored Oct 16, 2020
1 parent df241cc commit 274d361
Show file tree
Hide file tree
Showing 9 changed files with 158 additions and 123 deletions.
14 changes: 7 additions & 7 deletions src/app/components/forms/form-create/form-create.component.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="container-fluid">
<div class="d-flex flex-column mb-4">
<div class="cursor-pointer ">
<span (click)="onBackPressed()">&#8592; {{ "BACK" | translate }}</span>
<span (click)="onBackPressed()">&#8592; {{ "BACK" | translate }}</span>
</div>
<div class="control-container d-flex justify-content-between mt-2">
<h4>{{ "FORM_EDIT" | translate }}</h4>
Expand All @@ -13,14 +13,14 @@ <h4>{{ "FORM_EDIT" | translate }}</h4>
{{ "FORM_PUBLISH" | translate }}
</button>
</div>
</div>
</div>
</div>

<div class="card">
<div class="card-body">
<form [formGroup]="formDetailsFormGroup">
<div class="d-flex flex-row ">
<div class="d-flex flex-column grow-1">
<div class="row">
<div class="col-lg-6">
<div class="form-group">
<label for="form-title">{{ "FORM_TITLE" | translate }}</label>
<input
Expand All @@ -39,8 +39,8 @@ <h4>{{ "FORM_EDIT" | translate }}</h4>
placeholder="{{ 'FORM_CODE_PLACEHOLDER' | translate }}"
/>
</div>
</div>
<div class="d-flex flex-column grow-1 ml-4">
</div>
<div class="col-lg-6">
<div class="form-group">
<label for="form-cde">{{ "FORM_DESCRIPTION" | translate }}</label>
<textarea
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@



.form-create { //? this isn't on the form
.back-button {
font-weight: bold;
Expand Down Expand Up @@ -53,4 +54,7 @@

textarea {
min-height: 124px; // aligns to 2 inputs in a column layout
}
}



14 changes: 14 additions & 0 deletions src/app/components/forms/forms.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@import "node_modules/bootstrap/scss/functions";
@import "node_modules/bootstrap/scss/variables";
@import "node_modules/bootstrap/scss/mixins/_breakpoints";

@include media-breakpoint-up(xl) {

}
@include media-breakpoint-up(lg) {

}
@include media-breakpoint-up(md) {

}

46 changes: 24 additions & 22 deletions src/app/components/forms/option/option.component.html
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
<form [formGroup]="optionFormGroup">
<div class="mb-2">
<div class="col-md-8 d-flex flex-row">
<input type="text" class="form-control" placeholder="" formControlName="text">

<div class="col-md-8 option-container">
<input type="text" class="form-control" placeholder="" formControlName="text">
<div class="icon-holder">
<app-icon-toggle-input enabledIcon="/assets/forms/icon-text-enabled.png"
enabledIconTooltip="{{'MARK_AS_FREE_TEXT' | translate}}"
disabledIcon="/assets/forms/icon-text-disabled.png"
disabledIconTooltip="{{'MARK_AS_REGULAR' | translate}}"
formControlName="isFreeText">
</app-icon-toggle-input>
</div>

<div class="icon-holder">
<app-icon-toggle-input enabledIcon="/assets/forms/icon-text-enabled.png"
enabledIconTooltip="{{'MARK_AS_FREE_TEXT' | translate}}"
disabledIcon="/assets/forms/icon-text-disabled.png"
disabledIconTooltip="{{'MARK_AS_REGULAR' | translate}}"
formControlName="isFreeText">
</app-icon-toggle-input>
</div>
<div class="icon-holder">
<app-icon-toggle-input enabledIcon="/assets/forms/icon-flag-enabled.png"
enabledIconTooltip="{{'FLAG_OPTION' | translate}}"
disabledIcon="/assets/forms/icon-flag-disabled.png"
disabledIconTooltip="{{'UNFLAG_OPTION' | translate}}"
formControlName="flagged">
</app-icon-toggle-input>
</div>

<div class="icon-holder">
<app-icon-toggle-input enabledIcon="/assets/forms/icon-flag-enabled.png"
enabledIconTooltip="{{'FLAG_OPTION' | translate}}"
disabledIcon="/assets/forms/icon-flag-disabled.png"
disabledIconTooltip="{{'UNFLAG_OPTION' | translate}}"
formControlName="flagged">
</app-icon-toggle-input>
</div>

<div class="icon-holder" (click)="optionDeleteEventEmitter.emit()">
<img src="/assets/forms/icon-delete.png" alt="">
</div>
<div class="icon-holder" (click)="optionDeleteEventEmitter.emit()">
<img src="/assets/forms/icon-delete.png" alt="">
</div>
</div>
</div>

</form>

17 changes: 6 additions & 11 deletions src/app/components/forms/option/option.component.scss
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
.option-container {
.icon-holder {
display: flex;
flex-direction: row;
margin: 4px auto;
flex-direction: column;
justify-content: space-around;

.icon-holder {
display: flex;
flex-direction: column;
justify-content: space-around;
cursor: pointer;

cursor: pointer;

margin: auto 4px;
}
margin: auto 4px;
}

75 changes: 33 additions & 42 deletions src/app/components/forms/question/question.component.html
Original file line number Diff line number Diff line change
@@ -1,52 +1,43 @@

<div class="col-md-12 question-component">
<div class="field icon-holder" (click)="toggleOptions()">
<span *ngIf="hideOptions">
&#9654;
</span>
<span *ngIf="!hideOptions">
&#9660;
</span>
<div class="card mb-4">
<div class="card-header d-flex flex-row justify-content-between">
<div><span [ngClass]="{'rotate':hideOptions}" (click)="toggleOptions()"><img src="/assets/forms/down.png" alt=""></span> {{ questionFormGroup.controls['code']?.value || 'QUESTION_CODE' | translate }} - {{ questionFormGroup.controls['text']?.value || 'QUESTION_TEXT' | translate }}</div>
<div class="field icon-holder" (click)="questionDeleteEventEmitter.emit()">
<img src="/assets/forms/icon-delete.png" alt="">
</div>
</div>
<div class="card-body" [hidden]="hideOptions">

<div class="expandable-container">
<form [formGroup]="questionFormGroup">
<div class="main-fields-container">
<div class="field col-md-2">
<input class="form-control" formControlName="code" placeholder="{{'QUESTION_CODE' | translate}}">
</div>
<div class="field col-md-6">
<input class="form-control" formControlName="text" placeholder="{{'QUESTION_TEXT' | translate}}">
</div>
<div class="field col-md-2">
<select class="form-control" formControlName="questionType">
<option *ngFor="let questionType of questionTypes" [ngValue]="questionType.id">{{questionType.name | translate}}</option>
</select>
</div>
<div class="field icon-holder" (click)="questionDeleteEventEmitter.emit()">
<img src="/assets/forms/icon-delete.png" alt="">
<form [formGroup]="questionFormGroup">
<div class="row">
<div class="field col-lg-3 col-md-6">
<input class="form-control" formControlName="code" placeholder="{{'QUESTION_CODE' | translate}}">
</div>
<div class="field col-lg-6 col-md-12 order-2 mt-md-4 mt-lg-0">
<input class="form-control" formControlName="text" placeholder="{{'QUESTION_TEXT' | translate}}">
</div>
<div class="field col-lg-3 col-md-6 order-1">
<select class="form-control" formControlName="questionType">
<option *ngFor="let questionType of questionTypes" [ngValue]="questionType.id">{{questionType.name | translate}}</option>
</select>
</div>
</div>
</div>
</form>

<div [hidden]="hideOptions" class="options-panel">

<div cdkDropList
class="options-list"
(cdkDropListDropped)="onReorder($event)">
<div *ngFor="let option of optionFormGroupsArray; let i = index" cdkDrag class="option-line">
<app-option [optionFormGroup]="option"
(optionDeleteEventEmitter)="onOptionDelete(i)"
class="option">
</app-option>
</form>
<hr />
<div cdkDropList class="options-list" (cdkDropListDropped)="onReorder($event)">
<div *ngFor="let option of optionFormGroupsArray; let i = index" cdkDrag class="option-line">
<app-option [optionFormGroup]="option"
(optionDeleteEventEmitter)="onOptionDelete(i)"
class="option">
</app-option>

<div class="icon-holder icon-reorder" cdkDragHandle>
<img src="/assets/forms/icon-reorder.png" alt="">
<div class="icon-holder icon-reorder" cdkDragHandle>
<img src="/assets/forms/icon-reorder.png" alt="">
</div>
</div>
</div>
</div>

<div class="col-md-12 add-option-button" (click)="addOption()">+ {{'OPTION_ADD' | translate}}</div>
</div>
<div class="col add-option-button" (click)="addOption()">+ {{'OPTION_ADD' | translate}}</div>

</div>
</div>
39 changes: 33 additions & 6 deletions src/app/components/forms/question/question.component.scss
Original file line number Diff line number Diff line change
@@ -1,12 +1,39 @@

span {
&.rotate {
img {
transform: rotate(270deg)
}
}
}

.add-option-button {
color: rebeccapurple;
cursor: pointer;
}

.options-list {
display: flex;
flex-direction: column;

.option-line {
display: flex;
flex-direction: row;

.option {
flex-grow: 1;
}
}

}


.question-component {

display: flex;
flex-direction: row;

.add-option-button {
color: rebeccapurple;
cursor: pointer;
}


.options-panel {
background-color: #EDEDED;
Expand Down Expand Up @@ -53,7 +80,7 @@
cursor: pointer;
}

.field {
/* .field {
margin: 16px auto;
}
} */
}
64 changes: 33 additions & 31 deletions src/app/components/forms/section/section.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,41 +14,43 @@ <h4 class="header-text">{{
<div class="card">
<div class="card-body section-details">
<form [formGroup]="sectionFormGroup">
<div class="col-md-6">
<div class="form-labeled-field">
<div>
<span>{{ "SECTION_TITLE" | translate }}</span>
<div class="row">
<div class="col-lg-6">
<div class="form-labeled-field">
<div>
<span>{{ "SECTION_TITLE" | translate }}</span>
</div>
<div>
<input
class="form-control"
formControlName="description"
placeholder="{{ 'SECTION_TITLE_PLACEHOLDER' | translate }}"
/>
</div>
</div>
<div>
<input
class="form-control"
formControlName="description"
placeholder="{{ 'SECTION_TITLE_PLACEHOLDER' | translate }}"
/>
<div class="form-labeled-field">
<div>
<span>{{ "SECTION_CODE" | translate }}</span>
</div>
<div>
<input
class="form-control"
formControlName="code"
placeholder="{{ 'SECTION_CODE_PLACEHOLDER' | translate }}"
/>
</div>
</div>
</div>
<div class="form-labeled-field">
<div>
<span>{{ "SECTION_CODE" | translate }}</span>
</div>
<div>
<input
class="form-control"
formControlName="code"
placeholder="{{ 'SECTION_CODE_PLACEHOLDER' | translate }}"
/>
</div>
</div>
</div>
<div class="col-md-6">
<!-- According to the design, this field should be here, but for now it has no correspondence in the model.-->
<div class="col-lg-6">
<!-- According to the design, this field should be here, but for now it has no correspondence in the model.-->

<!-- <div>-->
<!-- <span>{{'SECTION_DESCRIPTION' | translate}}</span>-->
<!-- </div>-->
<!-- <div>-->
<!-- <textarea rows="4" class="form-control" [(ngModel)]="section.description" placeholder="{{'SECTION_DESCRIPTION_PLACEHOLDER' | translate}}"></textarea>-->
<!-- </div>-->
<!-- <div>-->
<!-- <span>{{'SECTION_DESCRIPTION' | translate}}</span>-->
<!-- </div>-->
<!-- <div>-->
<!-- <textarea rows="4" class="form-control" [(ngModel)]="section.description" placeholder="{{'SECTION_DESCRIPTION_PLACEHOLDER' | translate}}"></textarea>-->
<!-- </div>-->
</div>
</div>
</form>

Expand Down
6 changes: 3 additions & 3 deletions src/app/components/forms/section/section.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@
}

.icon-holder {
display: flex;
/* display: flex;
flex-direction: column;
justify-content: space-around;
justify-content: space-around; */

cursor: pointer;

margin: auto 4px;
margin: 12px 4px;
}

.icon-reorder {
Expand Down

1 comment on commit 274d361

@vercel
Copy link

@vercel vercel bot commented on 274d361 Oct 16, 2020

Choose a reason for hiding this comment

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

Please sign in to comment.