feat: nitroplus translate. Needs to fix
This commit is contained in:
46
nwaifu-ui/.eslintrc.json
Normal file
46
nwaifu-ui/.eslintrc.json
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"extends": [
|
||||
"../.eslintrc.base.json"
|
||||
],
|
||||
"ignorePatterns": [
|
||||
"!**/*"
|
||||
],
|
||||
"overrides": [
|
||||
{
|
||||
"files": [
|
||||
"*.ts"
|
||||
],
|
||||
"extends": [
|
||||
"plugin:@nx/angular",
|
||||
"plugin:@angular-eslint/template/process-inline-templates"
|
||||
],
|
||||
"rules": {
|
||||
"@angular-eslint/directive-selector": [
|
||||
"error",
|
||||
{
|
||||
"type": "attribute",
|
||||
"prefix": "nwui",
|
||||
"style": "camelCase"
|
||||
}
|
||||
],
|
||||
"@angular-eslint/component-selector": [
|
||||
"error",
|
||||
{
|
||||
"type": "element",
|
||||
"prefix": "nwui",
|
||||
"style": "kebab-case"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": [
|
||||
"*.html"
|
||||
],
|
||||
"extends": [
|
||||
"plugin:@nx/angular-template"
|
||||
],
|
||||
"rules": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
7
nwaifu-ui/README.md
Normal file
7
nwaifu-ui/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# nwaifu-ui
|
||||
|
||||
This library was generated with [Nx](https://nx.dev).
|
||||
|
||||
## Running unit tests
|
||||
|
||||
Run `nx test nwaifu-ui` to execute the unit tests.
|
||||
9
nwaifu-ui/project.json
Normal file
9
nwaifu-ui/project.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "nwaifu-ui",
|
||||
"$schema": "../node_modules/nx/schemas/project-schema.json",
|
||||
"sourceRoot": "nwaifu-ui/src",
|
||||
"prefix": "nwui",
|
||||
"projectType": "library",
|
||||
"tags": [],
|
||||
"targets": {}
|
||||
}
|
||||
1
nwaifu-ui/src/index.ts
Normal file
1
nwaifu-ui/src/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './lib';
|
||||
@@ -0,0 +1 @@
|
||||
<button [disabled]="disabled" [type]="type"><ng-content></ng-content></button>
|
||||
23
nwaifu-ui/src/lib/components/button/button.component.scss
Normal file
23
nwaifu-ui/src/lib/components/button/button.component.scss
Normal file
@@ -0,0 +1,23 @@
|
||||
button {
|
||||
outline: none;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
background-color: #5b3f45;
|
||||
padding: 1em 1.5em;
|
||||
color: #f5f6fa;
|
||||
border-radius: 15px;
|
||||
transition: ease-in-out 0.2s;
|
||||
width: 100%;
|
||||
&:hover,
|
||||
&:active {
|
||||
transform: scale(1.2);
|
||||
}
|
||||
&:disabled {
|
||||
opacity: 0.5;
|
||||
&:hover,
|
||||
&:active {
|
||||
cursor: not-allowed;
|
||||
transform: scale(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
15
nwaifu-ui/src/lib/components/button/button.component.ts
Normal file
15
nwaifu-ui/src/lib/components/button/button.component.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'nwui-button',
|
||||
templateUrl: './button.component.html',
|
||||
styleUrls: ['./button.component.scss'],
|
||||
standalone: true,
|
||||
imports: [CommonModule],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class NWUIButtonComponent {
|
||||
@Input() disabled = false;
|
||||
@Input() type = 'button';
|
||||
}
|
||||
1
nwaifu-ui/src/lib/components/button/index.ts
Normal file
1
nwaifu-ui/src/lib/components/button/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './button.component';
|
||||
2
nwaifu-ui/src/lib/components/index.ts
Normal file
2
nwaifu-ui/src/lib/components/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from './button';
|
||||
export * from './textarea';
|
||||
1
nwaifu-ui/src/lib/components/textarea/index.ts
Normal file
1
nwaifu-ui/src/lib/components/textarea/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './textarea.component';
|
||||
@@ -0,0 +1,5 @@
|
||||
<div [attr.contenteditable]="contenteditable" [className]="className" #ref (blur)="leaveFn()">
|
||||
@if(!value) {
|
||||
<ng-content></ng-content>
|
||||
}
|
||||
</div>
|
||||
@@ -0,0 +1,20 @@
|
||||
.nwui-textarea {
|
||||
border-radius: 8px;
|
||||
height: auto;
|
||||
color: #efdee0;
|
||||
outline: none;
|
||||
padding-inline: 2rem 1rem;
|
||||
background-color: transparent;
|
||||
border: 2px solid #e4bdc3;
|
||||
font-size: 1rem;
|
||||
font-weight: inherit;
|
||||
min-height: 3rem;
|
||||
line-height: 3rem;
|
||||
&:focus {
|
||||
border: 2px solid #efdee0;
|
||||
}
|
||||
&.disabled {
|
||||
opacity: 0.5;
|
||||
}
|
||||
word-wrap: break-word;
|
||||
}
|
||||
35
nwaifu-ui/src/lib/components/textarea/textarea.component.ts
Normal file
35
nwaifu-ui/src/lib/components/textarea/textarea.component.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { AfterViewInit, Component, ElementRef, EventEmitter, Input, Output, ViewChild } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'nwui-textarea',
|
||||
imports: [CommonModule],
|
||||
standalone: true,
|
||||
styleUrls: ['./textarea.component.scss'],
|
||||
templateUrl: './textarea.component.html',
|
||||
// changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class NWUITextAreaComponent implements AfterViewInit {
|
||||
@Input() disabled = false;
|
||||
@Input() value = '';
|
||||
@Input() contenteditable = true;
|
||||
@Output() leave = new EventEmitter<string>();
|
||||
@ViewChild('ref') ref: ElementRef<HTMLDivElement> | null = null;
|
||||
|
||||
get className(): string {
|
||||
return `nwui-textarea ${this.disabled && !this.contenteditable ? 'disabled' : ''}`;
|
||||
}
|
||||
|
||||
leaveFn() {
|
||||
if (this.ref) {
|
||||
const target = this.ref.nativeElement;
|
||||
const text = target.textContent || '';
|
||||
if (this.leave) this.leave.emit(text);
|
||||
target.textContent = text;
|
||||
}
|
||||
}
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
if (this.ref && this.value) this.ref.nativeElement.textContent = this.value;
|
||||
}
|
||||
}
|
||||
1
nwaifu-ui/src/lib/index.ts
Normal file
1
nwaifu-ui/src/lib/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './components';
|
||||
26
nwaifu-ui/tsconfig.json
Normal file
26
nwaifu-ui/tsconfig.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es2022",
|
||||
"useDefineForClassFields": false,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strict": true,
|
||||
"noImplicitOverride": true,
|
||||
"noPropertyAccessFromIndexSignature": true,
|
||||
"noImplicitReturns": true,
|
||||
"noFallthroughCasesInSwitch": true
|
||||
},
|
||||
"files": [],
|
||||
"include": [],
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.lib.json"
|
||||
}
|
||||
],
|
||||
"extends": "../tsconfig.base.json",
|
||||
"angularCompilerOptions": {
|
||||
"enableI18nLegacyMessageIdFormat": false,
|
||||
"strictInjectionParameters": true,
|
||||
"strictInputAccessModifiers": true,
|
||||
"strictTemplates": true
|
||||
}
|
||||
}
|
||||
12
nwaifu-ui/tsconfig.lib.json
Normal file
12
nwaifu-ui/tsconfig.lib.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../dist/out-tsc",
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"inlineSources": true,
|
||||
"types": []
|
||||
},
|
||||
"exclude": ["src/**/*.spec.ts", "src/test-setup.ts", "jest.config.ts", "src/**/*.test.ts"],
|
||||
"include": ["src/**/*.ts"]
|
||||
}
|
||||
Reference in New Issue
Block a user