Skip to content

Commit

Permalink
feat(design): allow individual button type imports (#3328)
Browse files Browse the repository at this point in the history
  • Loading branch information
xelaint authored Nov 12, 2024
1 parent 8656d7e commit 0af779d
Show file tree
Hide file tree
Showing 85 changed files with 2,199 additions and 1,534 deletions.
8 changes: 6 additions & 2 deletions apps/daffio/src/app/core/nav/header/header.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ import {
} from 'rxjs';

import { DaffLogoModule } from '@daffodil/branding';
import { DAFF_BUTTON_COMPONENTS } from '@daffodil/design/button';
import {
DaffButtonComponent,
DaffIconButtonComponent,
} from '@daffodil/design/button';
import { DaffRouterDataService } from '@daffodil/router';
import { DaffThemeSwitchButtonModule } from '@daffodil/theme-switch';

Expand All @@ -42,7 +45,8 @@ import { DaffioNavLink } from '../link/type';
DaffLogoModule,
DaffThemeSwitchButtonModule,
NgFor,
DAFF_BUTTON_COMPONENTS,
DaffButtonComponent,
DaffIconButtonComponent,
FaIconComponent,
AsyncPipe,
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
} from '@angular/core';
import { RouterLink } from '@angular/router';

import { DAFF_BUTTON_COMPONENTS } from '@daffodil/design/button';
import { DaffButtonComponent } from '@daffodil/design/button';
import { DAFF_CONTAINER_COMPONENTS } from '@daffodil/design/container';
import { DAFF_HERO_COMPONENTS } from '@daffodil/design/hero';

Expand All @@ -16,7 +16,7 @@ import { DAFF_HERO_COMPONENTS } from '@daffodil/design/hero';
standalone: true,
imports: [
DAFF_CONTAINER_COMPONENTS,
DAFF_BUTTON_COMPONENTS,
DaffButtonComponent,
DAFF_HERO_COMPONENTS,
RouterLink,
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
DaffInputModule,
DaffNativeSelectModule,
} from '@daffodil/design';
import { DAFF_BUTTON_COMPONENTS } from '@daffodil/design/button';
import { DaffButtonComponent } from '@daffodil/design/button';

import { DemoGeographyAddressSummaryComponent } from '../../../../geography/components/address-summary/address-summary.component';
import { DemoCheckoutAddressFormComponent } from '../../forms/address/components/address-form/address-form.component';
Expand All @@ -38,7 +38,7 @@ import { PaymentInfoFormFactory } from '../payment-info-form/factories/payment-i
DaffInputModule,
DaffNativeSelectModule,
DemoCheckoutPaymentInfoFormComponent,
DAFF_BUTTON_COMPONENTS,
DaffButtonComponent,
DaffCheckboxModule,
DemoCheckoutAddressFormComponent,
DemoGeographyAddressSummaryComponent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from '@angular/core';
import { ReactiveFormsModule } from '@angular/forms';

import { DAFF_BUTTON_COMPONENTS } from '@daffodil/design/button';
import { DaffButtonComponent } from '@daffodil/design/button';
import { DaffPersonalAddress } from '@daffodil/geography';

import { DemoCheckoutAddressFormComponent } from '../../forms/address/components/address-form/address-form.component';
Expand All @@ -25,7 +25,7 @@ import {
imports: [
DemoCheckoutAddressFormComponent,
ReactiveFormsModule,
DAFF_BUTTON_COMPONENTS,
DaffButtonComponent,
],
})
export class DemoCheckoutShippingAddressFormComponent implements OnInit {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
import { ReactiveFormsModule } from '@angular/forms';

import { DaffCartShippingRate } from '@daffodil/cart';
import { DAFF_BUTTON_COMPONENTS } from '@daffodil/design/button';
import { DaffButtonComponent } from '@daffodil/design/button';

import { DemoCheckoutAddressFormComponent } from '../../forms/address/components/address-form/address-form.component';
import { DemoCheckoutShippingOptionsComponent } from '../shipping-options/components/shipping-options/shipping-options.component';
Expand All @@ -27,7 +27,7 @@ import {
DemoCheckoutAddressFormComponent,
DemoCheckoutShippingOptionsComponent,
ReactiveFormsModule,
DAFF_BUTTON_COMPONENTS,
DaffButtonComponent,
],
})
export class DemoCheckoutShippingFormComponent implements OnInit {
Expand Down
4 changes: 2 additions & 2 deletions libs/design/button/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ Native `<button>` or `<a>` elements are always used in order to provide an easy,
## Usage

### Within a standalone component
To use button in a standalone component, import it directly into your custom component:
To use button in a standalone component, import it directly into your custom component. Buttons can be imported individually or all together by using `DAFF_BUTTON_COMPONENTS`:

```ts
@Component({
selector: 'custom-component',
templateUrl: './custom-component.component.html',
standalone: true,
imports: [
DAFF_BUTTON_COMPONENTS,
DaffButtonComponent,
],
})
export class CustomComponent {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
faChevronRight,
} from '@fortawesome/free-solid-svg-icons';

import { DAFF_BUTTON_COMPONENTS } from '@daffodil/design/button';
import { DaffButtonComponent } from '@daffodil/design/button';

@Component({
// eslint-disable-next-line @angular-eslint/component-selector
Expand All @@ -24,7 +24,7 @@ import { DAFF_BUTTON_COMPONENTS } from '@daffodil/design/button';
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
imports: [
DAFF_BUTTON_COMPONENTS,
DaffButtonComponent,
FaIconComponent,
],
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
faChevronRight,
} from '@fortawesome/free-solid-svg-icons';

import { DAFF_BUTTON_COMPONENTS } from '@daffodil/design/button';
import { DaffFlatButtonComponent } from '@daffodil/design/button';

@Component({
// eslint-disable-next-line @angular-eslint/component-selector
Expand All @@ -24,7 +24,7 @@ import { DAFF_BUTTON_COMPONENTS } from '@daffodil/design/button';
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
imports: [
DAFF_BUTTON_COMPONENTS,
DaffFlatButtonComponent,
FaIconComponent,
],
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
import { faPlus } from '@fortawesome/free-solid-svg-icons';

import { DAFF_BUTTON_COMPONENTS } from '@daffodil/design/button';
import { DaffIconButtonComponent } from '@daffodil/design/button';

@Component({
// eslint-disable-next-line @angular-eslint/component-selector
Expand All @@ -21,7 +21,7 @@ import { DAFF_BUTTON_COMPONENTS } from '@daffodil/design/button';
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
imports: [
DAFF_BUTTON_COMPONENTS,
DaffIconButtonComponent,
FaIconComponent,
],
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
faChevronRight,
} from '@fortawesome/free-solid-svg-icons';

import { DAFF_BUTTON_COMPONENTS } from '@daffodil/design/button';
import { DaffRaisedButtonComponent } from '@daffodil/design/button';

@Component({
// eslint-disable-next-line @angular-eslint/component-selector
Expand All @@ -24,7 +24,7 @@ import { DAFF_BUTTON_COMPONENTS } from '@daffodil/design/button';
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
imports: [
DAFF_BUTTON_COMPONENTS,
DaffRaisedButtonComponent,
FaIconComponent,
],
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
faChevronRight,
} from '@fortawesome/free-solid-svg-icons';

import { DAFF_BUTTON_COMPONENTS } from '@daffodil/design/button';
import { DaffStrokedButtonComponent } from '@daffodil/design/button';

@Component({
// eslint-disable-next-line @angular-eslint/component-selector
Expand All @@ -24,7 +24,7 @@ import { DAFF_BUTTON_COMPONENTS } from '@daffodil/design/button';
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
imports: [
DAFF_BUTTON_COMPONENTS,
DaffStrokedButtonComponent,
FaIconComponent,
],
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
faChevronRight,
} from '@fortawesome/free-solid-svg-icons';

import { DAFF_BUTTON_COMPONENTS } from '@daffodil/design/button';
import { DaffUnderlineButtonComponent } from '@daffodil/design/button';

@Component({
// eslint-disable-next-line @angular-eslint/component-selector
Expand All @@ -24,7 +24,7 @@ import { DAFF_BUTTON_COMPONENTS } from '@daffodil/design/button';
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
imports: [
DAFF_BUTTON_COMPONENTS,
DaffUnderlineButtonComponent,
FaIconComponent,
],
})
Expand Down
26 changes: 0 additions & 26 deletions libs/design/button/src/button-theme-variants/button.scss

This file was deleted.

25 changes: 0 additions & 25 deletions libs/design/button/src/button-theme-variants/flat.scss

This file was deleted.

21 changes: 0 additions & 21 deletions libs/design/button/src/button-theme-variants/icon.scss

This file was deleted.

36 changes: 0 additions & 36 deletions libs/design/button/src/button-theme-variants/raised.scss

This file was deleted.

28 changes: 0 additions & 28 deletions libs/design/button/src/button-theme-variants/stroked.scss

This file was deleted.

9 changes: 0 additions & 9 deletions libs/design/button/src/button-theme-variants/underline.scss

This file was deleted.

Loading

0 comments on commit 0af779d

Please sign in to comment.