Skip to content

Commit

Permalink
fix: format code
Browse files Browse the repository at this point in the history
  • Loading branch information
Bagusajieiswara committed Dec 1, 2024
1 parent c8a1428 commit 98cd36c
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 28 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
import { Component, HostBinding, OnInit, inject } from '@angular/core';

import { CommonModule } from '@angular/common';
import { NgxPrimerAccordionContentContext } from '../../contexts/accordion-content/accordion-content.context';
import { NgxPrimerAccordionItemComponent } from '../accordion-item/accordion-item.component';
import { NgxPrimerAccordionItemContext } from '../../contexts/accordion-item/accordion-item.context';
import { NgxPrimerAccordionRootComponent } from '../accordion-root/accordion-root.component';
import { customAlphabet } from 'nanoid';

const nanoid = customAlphabet('1234567890abcdef', 10)
let nextCounter = 0;
const nextIdentifier = nanoid(10);
/**
* Copyright [2024] [ElhakimDev]
*
Expand All @@ -26,6 +14,19 @@ const nextIdentifier = nanoid(10);
* limitations under the License.
*/

import { Component, HostBinding, OnInit, inject } from '@angular/core';

import { CommonModule } from '@angular/common';
import { NgxPrimerAccordionContentContext } from '../../contexts/accordion-content/accordion-content.context';
import { NgxPrimerAccordionItemComponent } from '../accordion-item/accordion-item.component';
import { NgxPrimerAccordionItemContext } from '../../contexts/accordion-item/accordion-item.context';
import { NgxPrimerAccordionRootComponent } from '../accordion-root/accordion-root.component';
import { customAlphabet } from 'nanoid';

const nanoid = customAlphabet('1234567890abcdef', 10);
let nextCounter = 0;
const nextIdentifier = nanoid(10);

@Component({
selector: 'ngx-primer-accordion-content',
standalone: true,
Expand All @@ -34,8 +35,9 @@ const nextIdentifier = nanoid(10);
templateUrl: './accordion-content.component.html',
styleUrl: './accordion-content.component.scss',
})
export class NgxPrimerAccordionContentComponent<T> implements OnInit {
protected id = `ngx-primer-accordion-content-${nextCounter++}-${nextIdentifier}`;
export class NgxPrimerAccordionContentComponent<T> implements OnInit {
protected id =
`ngx-primer-accordion-content-${nextCounter++}-${nextIdentifier}` as const;
protected readonly accordionItemContext = inject(
NgxPrimerAccordionItemContext,
{
Expand All @@ -59,6 +61,7 @@ export class NgxPrimerAccordionContentComponent<T> implements OnInit {
public get roleAttr() {
return 'region';
}

@HostBinding('attr.data-orientation')
public get dataOrientationAttr() {
return this.accordionRoot.orientation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { NgxPrimerAccordionRootContext } from '../../contexts/accordion-root/acc
import { NgxPrimerAccordionTriggerComponent } from '../accordion-trigger/accordion-trigger.component';
import { customAlphabet } from 'nanoid';

const nanoid = customAlphabet('1234567890abcdef', 10)
const nanoid = customAlphabet('1234567890abcdef', 10);
let nextCounter = 0;
const nextIdentifier = nanoid(10);
@Component({
Expand All @@ -45,9 +45,9 @@ const nextIdentifier = nanoid(10);
exportAs: 'ngxPrimerAccordionItemComponent',
})
export class NgxPrimerAccordionItemComponent<T> implements OnInit {

protected id = `ngx-primer-accordion-item-${nextCounter++}-${nextIdentifier}`;
protected id =
`ngx-primer-accordion-item-${nextCounter++}-${nextIdentifier}` as const;

public readonly accordionRootContext = inject(NgxPrimerAccordionRootContext, {
optional: true,
});
Expand Down Expand Up @@ -92,7 +92,7 @@ export class NgxPrimerAccordionItemComponent<T> implements OnInit {
public get accordionItemId() {
return this.id;
}

@HostBinding('attr.data-orientation')
public get dataOrientationAttr() {
return this.accordionRoot.orientation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ import {
import { CommonModule } from '@angular/common';
import { NgxPrimerAccordionItemComponent } from '../accordion-item/accordion-item.component';
import { NgxPrimerAccordionRootContext } from '../../contexts/accordion-root/accordion-root.context';
import { customAlphabet } from 'nanoid'
import { customAlphabet } from 'nanoid';
import { injectAccordionConfig } from '../../configs/accordion-config';

const nanoid = customAlphabet('1234567890abcdef', 10)
const nanoid = customAlphabet('1234567890abcdef', 10);
let nextCounter = 0;
const nextIdentifier = nanoid(10);

Expand All @@ -46,8 +46,8 @@ const nextIdentifier = nanoid(10);
exportAs: 'ngxPrimerAccordionRootComponent',
})
export class NgxPrimerAccordionRootComponent<T> implements OnInit {

protected id = `ngx-primer-accordion-root-${nextCounter++}-${nextIdentifier}`
protected id =
`ngx-primer-accordion-root-${nextCounter++}-${nextIdentifier}` as const;
/**
* Injects the `AccordionRootContext` service into the component or directive.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Component, HostBinding, HostListener, OnInit, inject } from '@angular/core';
import {
Component,
HostBinding,
HostListener,
OnInit,
inject,
} from '@angular/core';
import {
NgxPrimerAccordionItemContext,
NgxPrimerAccordionTriggerContext,
Expand All @@ -24,7 +30,7 @@ import { NgxPrimerAccordionItemComponent } from '../accordion-item/accordion-ite
import { NgxPrimerAccordionRootComponent } from '../accordion-root/accordion-root.component';
import { customAlphabet } from 'nanoid';

const nanoid = customAlphabet('1234567890abcdef', 10)
const nanoid = customAlphabet('1234567890abcdef', 10);
let nextCounter = 0;
const nextIdentifier = nanoid(10);
@Component({
Expand All @@ -36,8 +42,9 @@ const nextIdentifier = nanoid(10);
styleUrl: './accordion-trigger.component.scss',
})
export class NgxPrimerAccordionTriggerComponent<T> implements OnInit {
protected id = `ngx-primer-accordion-trigger-${nextCounter++}-${nextIdentifier}`;

protected id =
`ngx-primer-accordion-trigger-${nextCounter++}-${nextIdentifier}` as const;

protected readonly accordionItemContext = inject(
NgxPrimerAccordionItemContext,
{
Expand Down Expand Up @@ -86,6 +93,7 @@ export class NgxPrimerAccordionTriggerComponent<T> implements OnInit {
public get roleAttr() {
return 'button';
}

@HostBinding('attr.data-orientation')
public get dataOrientationAttr() {
return this.accordionRoot?.orientation();
Expand All @@ -95,7 +103,7 @@ export class NgxPrimerAccordionTriggerComponent<T> implements OnInit {
public get dataIsOpenAttr() {
return this.accordionItem.isOpen();
}

@HostBinding('attr.data-expanded')
public get dataExpandedAttr() {
return this.accordionItem.isOpen();
Expand Down

0 comments on commit 98cd36c

Please sign in to comment.