This repository was archived by the owner on Sep 20, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 13
Base Component Input: Text-Field (#288) #359
Open
Tristan-H11
wants to merge
20
commits into
issue/260-base-components
Choose a base branch
from
issue/288-text-input-base-component
base: issue/260-base-components
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 7 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
7d9c9df
Initial creation of input-field. (#288)
Tristan-H11 e791f02
Initial styling with open todos. (#288)
Tristan-H11 4f901d6
Merge branch 'issue/260-base-components' into issue/288-text-input-ba…
Tristan-H11 c620997
Replaced font-weight: bold with 500. (#260)
Tristan-H11 405dbe2
Added flavor and placeholder-styling. (#288)
Tristan-H11 ad18acd
Fixed coloring for the hint-text. (#288)
Tristan-H11 91cbbb2
Improved coloring for the hint-text. (#288)
Tristan-H11 a9a9d86
Empty defaults. (#288)
Tristan-H11 83bfd5e
Removed cloudflare trigger. (#288)
Tristan-H11 451437c
Improved focus behaviour. (#288)
Tristan-H11 c16f818
For whatever reason `accent-color` is not supported in my chrome v99,…
Tristan-H11 387f92f
Cleanup. (#288)
Tristan-H11 c4d04fb
Merge branch 'issue/260-base-components' into issue/288-text-input-ba…
Tristan-H11 45a1637
Changes examples to english. (#279)
Tristan-H11 30bbdab
Fixes for ma philipp boy <3. (#279)
Tristan-H11 7656aa5
Fixed hint color. (#279)
Tristan-H11 c6bd61c
Fixed fonts. (#279)
Tristan-H11 eb7c403
Reduced DOMs. (#279)
Tristan-H11 07ce265
Fixed Font. (#279)
Tristan-H11 ae090c4
Marcelsche Änderungen. (#288)
Tristan-H11 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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
10 changes: 10 additions & 0 deletions
10
src/core/components/inputs/text-input/text-input.component.html
This file contains hidden or 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,10 @@ | ||
<span> | ||
<label for="inputElement">{{label}}</label> | ||
<input id="inputElement" type="text" | ||
[placeholder]="placeholder" | ||
(keydown.enter)="onEnter.emit()" | ||
[class]="flavor" | ||
[disabled]="disabled"> | ||
<small [className]="coloredLabel() ? flavor : ''">{{hintText}}</small> | ||
</span> | ||
|
73 changes: 73 additions & 0 deletions
73
src/core/components/inputs/text-input/text-input.component.scss
This file contains hidden or 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,73 @@ | ||
@use "sass:list"; | ||
@import "src/global-styles/_theme-colors.scss"; | ||
|
||
$flavors: ( | ||
primary: ( | ||
$primary-default | ||
Tristan-H11 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
), | ||
success: ( | ||
$success-default | ||
), | ||
warning: ( | ||
$warning-default | ||
), | ||
danger: ( | ||
$danger-default | ||
), | ||
info: ( | ||
$info-default | ||
), | ||
); | ||
|
||
input { | ||
// TODO Clean up.. | ||
width: fit-content; | ||
min-width: 90%; | ||
margin-top: 2px; | ||
margin-bottom: 1px; | ||
|
||
background-color: $input-background; | ||
color: $light-font; | ||
font-family: inherit; | ||
font-size: inherit; | ||
|
||
padding: 8px 16px 8px 16px; | ||
border: 0; | ||
border-radius: 8px; | ||
|
||
&::placeholder { | ||
color: $placeholder-font | ||
} | ||
&:disabled::placeholder { | ||
color: $disabled-placeholder-font | ||
} | ||
|
||
@each $name, $colors in $flavors { | ||
&.#{$name} { | ||
&:focus { | ||
accent-color: list.nth($colors, 1); | ||
} | ||
} | ||
} | ||
} | ||
|
||
small { | ||
font-size: 16px; | ||
display: block; | ||
color: $grey-font; | ||
@each $name, $colors in $flavors { | ||
&.#{$name} { | ||
color: list.nth($colors, 1); | ||
} | ||
} | ||
} | ||
|
||
label { | ||
font-weight: 500; | ||
color: $light-font; | ||
} | ||
|
||
span { | ||
vertical-align: top; | ||
display: inline-block; | ||
} |
25 changes: 25 additions & 0 deletions
25
src/core/components/inputs/text-input/text-input.component.spec.ts
This file contains hidden or 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 { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { TextInputComponent } from './text-input.component'; | ||
|
||
describe('TextInputComponent', () => { | ||
let component: TextInputComponent; | ||
let fixture: ComponentFixture<TextInputComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
declarations: [ TextInputComponent ] | ||
}) | ||
.compileComponents(); | ||
}); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(TextInputComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
30 changes: 30 additions & 0 deletions
30
src/core/components/inputs/text-input/text-input.component.ts
This file contains hidden or 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 {Component, EventEmitter, Input, Output} from '@angular/core'; | ||
|
||
export type Flavor = 'primary' | 'success' | 'warning' | 'danger' | 'info'; | ||
|
||
|
||
@Component({ | ||
selector: 'design-text-input', | ||
templateUrl: './text-input.component.html', | ||
styleUrls: ['./text-input.component.scss'] | ||
}) | ||
export class TextInputComponent { | ||
|
||
@Input() public disabled = false; | ||
@Input() placeholder: string = "Placeholder"; | ||
Tristan-H11 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
@Input() hintText: string = "This is a small hint."; | ||
@Input() label: string = "Label"; | ||
@Input() hintColored: boolean = false; | ||
@Input() public flavor: Flavor = 'primary'; | ||
|
||
// eslint-disable-next-line @angular-eslint/no-output-on-prefix | ||
@Output() public onEnter = new EventEmitter<InputEvent>(); | ||
|
||
coloredLabel(): string { | ||
if(this.hintColored && !this.disabled){ | ||
return "colored"; | ||
} else { | ||
return ""; | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/core/components/inputs/text-input/text-input.module.ts
This file contains hidden or 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,18 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
import { TextInputComponent } from './text-input.component'; | ||
|
||
|
||
|
||
@NgModule({ | ||
declarations: [ | ||
TextInputComponent | ||
], | ||
imports: [ | ||
CommonModule | ||
], | ||
exports: [ | ||
TextInputComponent | ||
] | ||
}) | ||
export class TextInputModule { } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.