-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor: Replace @HostBinding with host property of Component Decora…
…tor (#58) * refactor: hlm-accordion-content * refactor: hlm-accordion * refactor: alert to host: _generatedClasses * refactor: computedClass * refactor: aspect ratio and avatar * refactor: badge button card * refactor: bulk update simple cases * refactor: bulk update simple cases * refactor: bulk update simple cases * refactor: @Hostbindings * refactor: host binding class structures * fix: id was not set correctly on brn switch * refactor: making all private signals readonly * refactor: rename and restructure generateclass and readonly signal * fix: imports and private varibales introduces while refactoring
- Loading branch information
1 parent
5b81a04
commit 84476e9
Showing
119 changed files
with
1,189 additions
and
1,319 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
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,11 +1,11 @@ | ||
import { Directive, HostBinding } from '@angular/core'; | ||
import { Directive } from '@angular/core'; | ||
|
||
@Directive({ | ||
selector: '[spartanContainer]', | ||
standalone: true, | ||
host: { | ||
class: | ||
'w-full mx-auto px-1 flex flex-1 items-start md:grid md:grid-cols-[220px_minmax(0,1fr)] lg:grid-cols-[240px_minmax(0,1fr)]', | ||
}, | ||
}) | ||
export class ContainerDirective { | ||
@HostBinding('class') | ||
public class = | ||
'w-full mx-auto px-1 flex flex-1 items-start md:grid md:grid-cols-[220px_minmax(0,1fr)] lg:grid-cols-[240px_minmax(0,1fr)]'; | ||
} | ||
export class ContainerDirective {} |
10 changes: 5 additions & 5 deletions
10
apps/app/src/app/shared/layout/side-nav/side-nav-heading.directive.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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import { Directive, HostBinding } from '@angular/core'; | ||
import { Directive } from '@angular/core'; | ||
|
||
@Directive({ | ||
selector: '[spartanSideNavHeading]', | ||
standalone: true, | ||
host: { | ||
class: 'flex items-center justify-between mb-1 rounded-md px-2 py-1 font-semibold', | ||
}, | ||
}) | ||
export class SideNavHeadingDirective { | ||
@HostBinding('class') | ||
public class = 'flex items-center justify-between mb-1 rounded-md px-2 py-1 font-semibold'; | ||
} | ||
export class SideNavHeadingDirective {} |
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
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
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
20 changes: 10 additions & 10 deletions
20
libs/ui/accordion/helm/src/lib/hlm-accordion-item.directive.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 |
---|---|---|
@@ -1,23 +1,23 @@ | ||
import { Directive, HostBinding, Input } from '@angular/core'; | ||
import { Directive, Input, computed, signal } from '@angular/core'; | ||
import { hlm } from '@spartan-ng/ui-core'; | ||
import { ClassValue } from 'clsx'; | ||
|
||
@Directive({ | ||
selector: '[hlmAccordionItem],brn-accordion-item[hlm]', | ||
standalone: true, | ||
host: { | ||
'[class]': '_computedClass()', | ||
}, | ||
}) | ||
export class HlmAccordionItemDirective { | ||
@HostBinding('class') | ||
private _class = this.generateClass(); | ||
private _inputs: ClassValue = ''; | ||
|
||
private readonly _userCls = signal<ClassValue>(''); | ||
@Input() | ||
set class(inputs: ClassValue) { | ||
this._inputs = inputs; | ||
this._class = this.generateClass(); | ||
set class(userCls: ClassValue) { | ||
this._userCls.set(userCls); | ||
} | ||
|
||
generateClass() { | ||
return hlm('flex flex-1 flex-col border-b border-border', this._inputs); | ||
protected _computedClass = computed(() => this._generateClass()); | ||
private _generateClass() { | ||
return hlm('flex flex-1 flex-col border-b border-border', this._userCls()); | ||
} | ||
} |
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
20 changes: 10 additions & 10 deletions
20
libs/ui/accordion/helm/src/lib/hlm-accordion.directive.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 |
---|---|---|
@@ -1,23 +1,23 @@ | ||
import { Directive, HostBinding, Input } from '@angular/core'; | ||
import { Directive, Input, computed, signal } from '@angular/core'; | ||
import { hlm } from '@spartan-ng/ui-core'; | ||
import { ClassValue } from 'clsx'; | ||
|
||
@Directive({ | ||
selector: '[hlmAccordion],brn-accordion[hlm]', | ||
standalone: true, | ||
host: { | ||
'[class]': '_computedClass()', | ||
}, | ||
}) | ||
export class HlmAccordionDirective { | ||
@HostBinding('class') | ||
private _class = this.generateClass(); | ||
private _inputs: ClassValue = ''; | ||
|
||
private readonly _userCls = signal<ClassValue>(''); | ||
@Input() | ||
set class(inputs: ClassValue) { | ||
this._inputs = inputs; | ||
this._class = this.generateClass(); | ||
set class(userCls: ClassValue) { | ||
this._userCls.set(userCls); | ||
} | ||
|
||
generateClass() { | ||
return hlm('flex flex-col', this._inputs); | ||
protected _computedClass = computed(() => this._generateClass()); | ||
private _generateClass() { | ||
return hlm('flex flex-col', this._userCls()); | ||
} | ||
} |
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
20 changes: 10 additions & 10 deletions
20
libs/ui/alert-dialog/helm/src/lib/hlm-alert-dialog-close.directive.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 |
---|---|---|
@@ -1,26 +1,26 @@ | ||
import { Directive, HostBinding, Input } from '@angular/core'; | ||
import { Directive, Input, computed, signal } from '@angular/core'; | ||
import { hlm } from '@spartan-ng/ui-core'; | ||
import { ClassValue } from 'clsx'; | ||
|
||
@Directive({ | ||
selector: '[hlmAlertDialogClose],[brnAlertDialogClose][hlm]', | ||
standalone: true, | ||
host: { | ||
'[class]': '_computedClass()', | ||
}, | ||
}) | ||
export class HlmAlertDialogCloseDirective { | ||
@HostBinding('class') | ||
_class = this.generateClasses(); | ||
private _inputs: ClassValue = ''; | ||
|
||
private readonly _userCls = signal<ClassValue>(''); | ||
@Input() | ||
set class(inputs: ClassValue) { | ||
this._inputs = inputs; | ||
this._class = this.generateClasses(); | ||
set class(userCls: ClassValue) { | ||
this._userCls.set(userCls); | ||
} | ||
|
||
private generateClasses() { | ||
protected _computedClass = computed(() => this._generateClass()); | ||
private _generateClass() { | ||
return hlm( | ||
'absolute right-4 top-4 [&>hlm-icon]:h-4 [&>hlm-icon]:w-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground', | ||
this._inputs, | ||
this._userCls(), | ||
); | ||
} | ||
} |
Oops, something went wrong.
84476e9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
spartan – ./
spartan-git-main-goetzrobin.vercel.app
www.spartan.ng
spartan-goetzrobin.vercel.app
spartan.ng