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
import { makeNotification } from "./makeNotification"; | |
// 'SuccessNotification' component is used for rendering success notifications | |
export const SuccessNotification = makeNotification( | |
"check-circle", // icon name | |
"#dff0d8", // primary color | |
"#3c763d" // accent color | |
); |
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
import React from "react"; | |
import PropTypes from "prop-types"; | |
import { StyleSheet, TouchableOpacity, Text } from "react-native"; | |
import { FontAwesome } from "@expo/vector-icons"; | |
const ICON_SQUARE_SIZE = 100; | |
// 'makeNotification' is a HOC | |
export const makeNotification = ( | |
// these values depend on notification type |
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
<div class="form-group"> | |
<label for="field1-od" class="required">Field #1</label> | |
<input formControlName="field1" type="text" | |
id="field1-od" placeholder="Enter Field #1"> | |
</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
<custom-labeled-input formControlName="field1" [isRequired]="true" [type]="'text'" | |
[id]="'field1'" [placeholder]="'Enter Field #1'" [label]="'Field #1'"></custom-labeled-input> |
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
import { Component, ElementRef, ViewChild } from '@angular/core'; | |
import { FormsModule } from '@angular/forms'; | |
import { ComponentFixture, TestBed, tick, async, fakeAsync } from '@angular/core/testing'; | |
import { CustomControlsModule } from '../../custom-controls.module'; | |
@Component({ | |
template: ` | |
<custom-input [placeholder]="placeholder" [type]="type" [id]="id" [(ngModel)]="name"></custom-input> | |
` | |
}) |
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
import { NgModule } from '@angular/core'; | |
import { CommonModule } from '@angular/common'; | |
import { FormsModule } from '@angular/forms'; | |
import { InputComponent } from './components/input/input.component'; | |
import { LabeledComponent } from './components/labeled/labeled.component'; | |
import { LabeledInputComponent } from './components/labeled-input/labeled-input.component'; | |
@NgModule({ | |
imports: [ CommonModule, FormsModule ], |
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
import { Component, OnInit, forwardRef, Input, ViewChild } from '@angular/core'; | |
import { NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms'; | |
import { InputComponent } from '../input/input.component'; | |
@Component({ | |
selector: 'custom-labeled-input', | |
templateUrl: './labeled-input.component.html', | |
styleUrls: ['./labeled-input.component.css'], | |
providers: [{ | |
provide: NG_VALUE_ACCESSOR, |
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
<custom-labeled | |
class="catch-validation-events" | |
[label]="label" | |
[id]="id" | |
[isRequired]="isRequired"> | |
<custom-input | |
#input | |
[(ngModel)]="value" | |
[type]="type" |
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
import { Component, Input } from '@angular/core'; | |
@Component({ | |
selector: 'custom-labeled', | |
templateUrl: './labeled.component.html', | |
styleUrls: ['./labeled.component.css'] | |
}) | |
export class LabeledComponent { | |
@Input() label: string = ''; | |
@Input() id: string = ''; |
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
<div class="form-group group"> | |
<label | |
[for]="id" | |
[ngClass]="{ 'required': isRequired }">{{label}}</label> | |
<ng-content></ng-content> | |
</div> |